diff --git a/onadata/apps/logger/migrations/0005_add_date_fields_indexing.py b/onadata/apps/logger/migrations/0005_add_date_fields_indexing.py index f5af866ac6..34eda7809c 100644 --- a/onadata/apps/logger/migrations/0005_add_date_fields_indexing.py +++ b/onadata/apps/logger/migrations/0005_add_date_fields_indexing.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.18 on 2023-03-14 12:22 +# Generated by Django 3.2.20 on 2023-08-06 13:39 from django.db import migrations, models @@ -14,16 +14,16 @@ class Migration(migrations.Migration): migrations.SeparateDatabaseAndState( database_operations=[ migrations.RunSQL( - sql='CREATE INDEX CONCURRENTLY "logger_inst_date_cr_42899d_idx" ON "logger_instance" ("date_created");', - reverse_sql='DROP INDEX "logger_inst_date_cr_42899d_idx";', + sql='CREATE INDEX CONCURRENTLY "logger_inst_date_cr_42899d_idx" ON "logger_instance" ((json->>\'_date_created\')) WHERE (json->>\'_date_created\') IS NOT NULL;', + reverse_sql='DROP INDEX "logger_inst_date_cr_json_42899d_idx";', ), migrations.RunSQL( - sql='CREATE INDEX CONCURRENTLY "logger_inst_date_mo_5a1bd3_idx" ON "logger_instance" ("date_modified");', - reverse_sql='DROP INDEX "logger_inst_date_mo_5a1bd3_idx";', + sql='CREATE INDEX CONCURRENTLY "logger_inst_date_mo_5a1bd3_idx" ON "logger_instance" ((json->>\'_date_modified\')) WHERE (json->>\'_date_modified\') IS NOT NULL;', + reverse_sql='DROP INDEX "logger_inst_date_mo_json_5a1bd3_idx";', ), migrations.RunSQL( - sql='CREATE INDEX CONCURRENTLY "logger_inst_deleted_da31a3_idx" ON "logger_instance" ("deleted_at");', - reverse_sql='DROP INDEX "logger_inst_deleted_da31a3_idx";', + sql='CREATE INDEX CONCURRENTLY "logger_inst_deleted_da31a3_idx" ON "logger_instance" ((json->>\'_deleted_at\')) WHERE (json->>\'_deleted_at\') IS NOT NULL;', + reverse_sql='DROP INDEX "logger_inst_deleted_at_json_da31a3_idx";', ), ], state_operations=[ @@ -42,13 +42,9 @@ class Migration(migrations.Migration): migrations.AddIndex( model_name="instance", index=models.Index( - fields=["deleted_at"], name="logger_inst_deleted_da31a3_idx" + fields=["deleted_at"], name="logger_inst_deleted_at_da31a3_idx" ), ), ], ) ] - - - -