@@ -47,6 +47,18 @@ def manually_drop_indexes_instructions(apps, schema_editor):
47
47
"""
48
48
)
49
49
50
+ def warning_long_run (apps , schema_editor ):
51
+ print (
52
+ """
53
+ This might take a while. If it is too slow, you may want to
54
+ interrupt this migration, cancel any outstanding `CREATE…` or `DROP
55
+ INDEX` queries on `kpi_importtask` and `kpi_exporttask`, re-run the
56
+ migration with `SKIP_HEAVY_MIGRATIONS=True`, and then follow the
57
+ printed instructions to set up the indexes concurrently (without
58
+ downtime) using raw SQL.
59
+ """
60
+ )
61
+
50
62
51
63
class Migration (migrations .Migration ):
52
64
@@ -55,17 +67,8 @@ class Migration(migrations.Migration):
55
67
]
56
68
57
69
if not settings .SKIP_HEAVY_MIGRATIONS :
58
- print (
59
- """
60
- This might take a while. If it is too slow, you may want to
61
- interrupt this migration, cancel any outstanding `CREATE…` or `DROP
62
- INDEX` queries on `kpi_importtask` and `kpi_exporttask`, re-run the
63
- migration with `SKIP_HEAVY_MIGRATIONS=True`, and then follow the
64
- printed instructions to set up the indexes concurrently (without
65
- downtime) using raw SQL.
66
- """
67
- )
68
70
operations = [
71
+ migrations .RunPython (warning_long_run , warning_long_run ),
69
72
migrations .AddIndex (
70
73
model_name = 'importtask' ,
71
74
index = django .contrib .postgres .indexes .BTreeIndex (
0 commit comments