Skip to content

Commit 5298d5d

Browse files
committed
refactor(surveys): simplify 0905 to only add column, no FK
1 parent ffc971a commit 5298d5d

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed
Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,20 @@
11
# Generated by Django 4.2.26 on 2025-11-18 16:03
22

3-
import django.db.models.deletion
4-
from django.db import migrations, models
3+
from django.db import migrations
54

65

7-
# see 0415_pluginconfig_match_action.py
86
class Migration(migrations.Migration):
9-
atomic = False # Added to support concurrent index creation
107
dependencies = [
118
("posthog", "0904_alter_dashboard_creation_mode"),
129
]
1310

1411
operations = [
15-
migrations.SeparateDatabaseAndState(
16-
state_operations=[
17-
migrations.AddField(
18-
model_name="survey",
19-
name="linked_insight",
20-
field=models.ForeignKey(
21-
blank=True,
22-
null=True,
23-
on_delete=django.db.models.deletion.SET_NULL,
24-
related_name="surveys_linked_insight",
25-
related_query_name="survey_linked_insight",
26-
to="posthog.insight",
27-
),
28-
)
29-
],
30-
database_operations=[
31-
migrations.RunSQL(
32-
"""
33-
ALTER TABLE "posthog_survey" ADD COLUMN "linked_insight_id" integer NULL CONSTRAINT "posthog_survey_linked_insight_id_586524f3_fk_posthog_d" REFERENCES "posthog_dashboarditem"("id") DEFERRABLE INITIALLY DEFERRED; -- existing-table-constraint-ignore
34-
SET CONSTRAINTS "posthog_survey_linked_insight_id_586524f3_fk_posthog_d" IMMEDIATE; -- existing-table-constraint-ignore
35-
""",
36-
reverse_sql="""
37-
ALTER TABLE "posthog_survey" DROP COLUMN IF EXISTS "linked_insight_id";
38-
""",
39-
),
40-
],
41-
)
12+
migrations.RunSQL(
13+
"""
14+
ALTER TABLE "posthog_survey" ADD COLUMN IF NOT EXISTS "linked_insight_id" integer NULL;
15+
""",
16+
reverse_sql="""
17+
ALTER TABLE "posthog_survey" DROP COLUMN IF EXISTS "linked_insight_id";
18+
""",
19+
),
4220
]

0 commit comments

Comments
 (0)