diff --git a/reversion/migrations/0003_add_cast_index_on_object_id.py b/reversion/migrations/0003_add_cast_index_on_object_id.py index 840b1b37..b57fbecb 100644 --- a/reversion/migrations/0003_add_cast_index_on_object_id.py +++ b/reversion/migrations/0003_add_cast_index_on_object_id.py @@ -1,4 +1,4 @@ -# Generated manually lol +# Generated manually from django.db import migrations diff --git a/reversion/migrations/0004_add_index_recover_optimization.py b/reversion/migrations/0004_add_index_recover_optimization.py new file mode 100644 index 00000000..5443b2d9 --- /dev/null +++ b/reversion/migrations/0004_add_index_recover_optimization.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.15 on 2024-09-01 17:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + atomic = False + + dependencies = [ + ("reversion", "0003_add_cast_index_on_object_id"), + ] + + operations = [ + migrations.RunSQL( + sql=""" +CREATE INDEX CONCURRENTLY IF NOT EXISTS "reversion_version_recover_optimization" ON +"reversion_version" (content_type_id, db, object_id, id DESC); + """, + reverse_sql=""" +DROP INDEX CONCURRENTLY IF EXISTS "reversion_version_recover_optimization"; +""", + elidable=False, + ), + ]