diff --git a/api/app_analytics/migrations/0002_featureevaluationraw_identifier_and_index_feature.py b/api/app_analytics/migrations/0002_featureevaluationraw_identifier_and_index_feature.py index bf00993dcee2..1274cf285724 100644 --- a/api/app_analytics/migrations/0002_featureevaluationraw_identifier_and_index_feature.py +++ b/api/app_analytics/migrations/0002_featureevaluationraw_identifier_and_index_feature.py @@ -5,8 +5,11 @@ class Migration(migrations.Migration): - - atomic = False + """ + This migration class used to include the addition of the index that now lives + in 0003_add_feature_name_index. The reason for this can be attributed to the + discussion here: https://github.com/Flagsmith/flagsmith/issues/3425 + """ dependencies = [ ('app_analytics', '0001_initial'), @@ -23,19 +26,4 @@ class Migration(migrations.Migration): name='enabled_when_evaluated', field=models.BooleanField(null=True, default=None), ), - migrations.SeparateDatabaseAndState( - state_operations=[ - migrations.AlterField( - model_name='featureevaluationraw', - name='feature_name', - field=models.CharField(db_index=True, max_length=2000), - ), - ], - database_operations=[ - PostgresOnlyRunSQL( - 'CREATE INDEX CONCURRENTLY "app_analytics_featureevaluationraw_feature_name_idx" ON "app_analytics_featureevaluationraw" ("feature_name");', - reverse_sql='DROP INDEX CONCURRENTLY "app_analytics_featureevaluationraw_feature_name_idx";', - ) - ], - ), ] diff --git a/api/app_analytics/migrations/0003_add_feature_name_index.py b/api/app_analytics/migrations/0003_add_feature_name_index.py new file mode 100644 index 000000000000..81884c5200b3 --- /dev/null +++ b/api/app_analytics/migrations/0003_add_feature_name_index.py @@ -0,0 +1,32 @@ +# Generated by Django 3.2.23 on 2024-02-15 18:33 + +from django.db import migrations, models + +from core.migration_helpers import PostgresOnlyRunSQL + + +class Migration(migrations.Migration): + + atomic = False + + dependencies = [ + ("app_analytics", "0002_featureevaluationraw_identifier_and_index_feature"), + ] + + operations = [ + migrations.SeparateDatabaseAndState( + state_operations=[ + migrations.AlterField( + model_name="featureevaluationraw", + name="feature_name", + field=models.CharField(db_index=True, max_length=2000), + ), + ], + database_operations=[ + PostgresOnlyRunSQL( + 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "app_analytics_featureevaluationraw_feature_name_idx" ON "app_analytics_featureevaluationraw" ("feature_name");', + reverse_sql='DROP INDEX CONCURRENTLY IF EXISTS "app_analytics_featureevaluationraw_feature_name_idx";', + ) + ], + ), + ]