From b367634863017752be890e75b1841aac8a54e183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Far=C3=ADas=20Santana?= Date: Wed, 7 Aug 2024 15:33:34 +0200 Subject: [PATCH] fix(data-models): Update migration to defer constraint --- .../0452_datawarehousemodelpath_and_more.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/posthog/migrations/0452_datawarehousemodelpath_and_more.py b/posthog/migrations/0452_datawarehousemodelpath_and_more.py index c92d781d7525c..f06abc1eb8290 100644 --- a/posthog/migrations/0452_datawarehousemodelpath_and_more.py +++ b/posthog/migrations/0452_datawarehousemodelpath_and_more.py @@ -1,10 +1,10 @@ -# Generated by Django 4.2.14 on 2024-08-06 18:20 +# Generated by Django 4.2.14 on 2024-08-07 13:24 -import django.contrib.postgres.indexes -import django.db.models.deletion from django.conf import settings +import django.contrib.postgres.indexes from django.db import migrations, models - +import django.db.models.constraints +import django.db.models.deletion import posthog.models.utils import posthog.warehouse.models.modeling @@ -15,7 +15,6 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunSQL("CREATE EXTENSION ltree;"), migrations.CreateModel( name="DataWarehouseModelPath", fields=[ @@ -66,6 +65,10 @@ class Migration(migrations.Migration): ), migrations.AddConstraint( model_name="datawarehousemodelpath", - constraint=models.UniqueConstraint(fields=("team_id", "path"), name="unique_team_id_path"), + constraint=models.UniqueConstraint( + deferrable=django.db.models.constraints.Deferrable["IMMEDIATE"], + fields=("team_id", "path"), + name="unique_team_id_path", + ), ), ]