Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent SKIP_HEAVY_MIGRATIONS warning unless running the relevant migrations #894

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions onadata/apps/main/migrations/0011_drop_old_kpi_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ def get_operations():
return []

tables = DEPRECATED_TABLES + KPI_TABLES
print(
"""
This migration might take a while. If it is too slow, you may want to
re-run migrations with SKIP_HEAVY_MIGRATIONS=True and apply this one
manually from the django shell.
"""
)
operations = []

sql = """
Expand Down Expand Up @@ -105,10 +98,22 @@ def get_operations():
return operations


def print_migration_warning(apps, schema_editor):
if settings.TESTING_MODE or settings.SKIP_HEAVY_MIGRATIONS:
return
print(
"""
This migration might take a while. If it is too slow, you may want to
re-run migrations with SKIP_HEAVY_MIGRATIONS=True and apply this one
manually from the django shell.
"""
)


class Migration(migrations.Migration):

dependencies = [
('main', '0010_userprofile_metadata_jsonfield'),
]

operations = get_operations()
operations = [migrations.RunPython(print_migration_warning), *get_operations()]
Loading