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

Add index migration #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion reversion/migrations/0003_add_cast_index_on_object_id.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated manually lol
# Generated manually

from django.db import migrations

Expand Down
24 changes: 24 additions & 0 deletions reversion/migrations/0004_add_index_recover_optimization.py
Original file line number Diff line number Diff line change
@@ -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,
),
]