Skip to content

Commit

Permalink
atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverb123 committed Jul 24, 2024
1 parent d07945b commit 5fdf680
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


class Migration(migrations.Migration):
atomic = False # Added to support concurrent index creation
dependencies = [
("posthog", "0448_add_mysql_externaldatasource_source_type"),
]
Expand Down Expand Up @@ -64,13 +65,14 @@ class Migration(migrations.Migration):
migrations.RunSQL(
"""
ALTER TABLE "posthog_plugin" ADD CONSTRAINT "posthog_plugin_url_bccac89d_uniq" UNIQUE ("url"); -- existing-table-constraint-ignore
CREATE INDEX "posthog_plugin_url_bccac89d_like" ON "posthog_plugin" ("url" varchar_pattern_ops);
""",
reverse_sql="""
DROP INDEX IF EXISTS "posthog_plugin_url_bccac89d_like";
ALTER TABLE "posthog_plugin" DROP CONSTRAINT IF EXISTS "posthog_plugin_url_bccac89d_uniq"; -- existing-table-constraint-ignore
""",
)
"""
),
# We add the index seperately
migrations.RunSQL(
"""
CREATE INDEX CONCURRENTLY "posthog_plugin_url_bccac89d_like" ON "posthog_plugin" ("url" varchar_pattern_ops);
"""
),
],
),
]

0 comments on commit 5fdf680

Please sign in to comment.