Skip to content

Commit 50c5681

Browse files
committed
Move squash migrations script into tools directory
1 parent a50fb01 commit 50c5681

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

squash_migrations.py renamed to tools/squash_migrations.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ def get_app_names(exclude: List[str]) -> List[str]:
4646
Gets names of all apps using migrations
4747
"""
4848
names = []
49-
for app_dir in os.scandir("temba"):
49+
for app_dir in os.scandir("../temba"):
5050
if app_dir.is_dir() and app_dir.name not in exclude:
51-
mig_dir = os.path.join("temba", app_dir.name, "migrations")
51+
mig_dir = os.path.join("../temba", app_dir.name, "migrations")
5252
if os.path.exists(mig_dir):
5353
names.append(app_dir.name)
5454
return sorted(names)
@@ -59,7 +59,7 @@ def get_app_migration_modules(app_name: str) -> List[str]:
5959
Gets module names of all migration files for the given app
6060
"""
6161
mods = []
62-
mig_dir = os.path.join("temba", app_name, "migrations")
62+
mig_dir = os.path.join("../temba", app_name, "migrations")
6363
for mig_file in os.scandir(mig_dir):
6464
if MIGRATION_FILENAME_REGEX.match(mig_file.name):
6565
mods.append(mig_file.name[:-3])
@@ -185,9 +185,9 @@ def transform(data):
185185
last_mig = get_app_migration_modules("sql")[-1]
186186
mig_path = f"temba/sql/migrations/{last_mig}.py"
187187
mig_num = last_mig[:4]
188-
shutil.copy2("temba/sql/current_functions.sql", f"temba/sql/migrations/{mig_num}_functions.sql")
189-
shutil.copy2("temba/sql/current_indexes.sql", f"temba/sql/migrations/{mig_num}_indexes.sql")
190-
shutil.copy2("temba/sql/current_triggers.sql", f"temba/sql/migrations/{mig_num}_triggers.sql")
188+
shutil.copy2("../temba/sql/current_functions.sql", f"temba/sql/migrations/{mig_num}_functions.sql")
189+
shutil.copy2("../temba/sql/current_indexes.sql", f"temba/sql/migrations/{mig_num}_indexes.sql")
190+
shutil.copy2("../temba/sql/current_triggers.sql", f"temba/sql/migrations/{mig_num}_triggers.sql")
191191
ops = f'InstallSQL("{mig_num}_functions"), InstallSQL("{mig_num}_indexes"), InstallSQL("{mig_num}_triggers")'
192192

193193
def transform(data):

0 commit comments

Comments
 (0)