Skip to content

Commit 8bd7e4e

Browse files
committed
chore(Persons): Remove foreign key constraints for all persons models
1 parent 88497af commit 8bd7e4e

2 files changed

+32
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 4.2.15 on 2025-01-17 01:29
2+
3+
from django.db import migrations
4+
from django.db.migrations.operations.special import SeparateDatabaseAndState
5+
6+
7+
class Migration(migrations.Migration):
8+
dependencies = [
9+
("posthog", "0545_insight_filters_to_query"),
10+
]
11+
12+
operations = [
13+
SeparateDatabaseAndState(
14+
database_operations=[
15+
migrations.RunSQL(
16+
"""
17+
ALTER TABLE posthog_person DROP CONSTRAINT IF EXISTS posthog_person_team_id_fkey;
18+
ALTER TABLE posthog_person DROP CONSTRAINT IF EXISTS posthog_person_is_user_id_fkey;
19+
ALTER TABLE posthog_persondistinctid DROP CONSTRAINT IF EXISTS posthog_persondistinctid_team_id_fkey;
20+
ALTER TABLE posthog_personlessdistinctid DROP CONSTRAINT IF EXISTS posthog_personlessdistinctid_team_id_fkey;
21+
ALTER TABLE posthog_featureflaghashkeyoverride DROP CONSTRAINT IF EXISTS posthog_featureflaghashkeyoverride_team_id_fkey;
22+
ALTER TABLE posthog_cohortpeople DROP CONSTRAINT IF EXISTS posthog_cohortpeople_cohort_id_fkey;
23+
""",
24+
"""
25+
-- No reverse SQL needed since we're dropping constraints that will be recreated in a different form
26+
""",
27+
)
28+
],
29+
state_operations=[],
30+
),
31+
]

posthog/migrations/max_migration.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0545_insight_filters_to_query
1+
0546_remove_featureflaghashkeyoverride_unique_hash_key_for_a_user_team_feature_flag_combo_and_more

0 commit comments

Comments
 (0)