From 1fc45a3a8f0cf0e2fbcdbcf37841af47e9f88398 Mon Sep 17 00:00:00 2001 From: Matias Bordese Date: Tue, 28 May 2024 16:28:24 -0300 Subject: [PATCH] Fix team uniqueness db migration --- .../migrations/0022_alter_team_unique_together.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/apps/user_management/migrations/0022_alter_team_unique_together.py b/engine/apps/user_management/migrations/0022_alter_team_unique_together.py index d3eca7bd36..02774ca37c 100644 --- a/engine/apps/user_management/migrations/0022_alter_team_unique_together.py +++ b/engine/apps/user_management/migrations/0022_alter_team_unique_together.py @@ -32,7 +32,9 @@ def clean_up_duplicated_teams(apps, schema_editor): for team in duplicated_teams: # if there is anything to migrate, do it here team.escalation_chains.update(team=first_team) - team.alert_receive_channels.exclude(integration="direct_paging").update(team=first_team) + # remove direct paging integrations before removing teams + team.alert_receive_channels.filter(integration="direct_paging").delete() + team.alert_receive_channels.update(team=first_team) team.custom_on_call_shifts.update(team=first_team) team.oncall_schedules.update(team=first_team) team.webhooks.update(team=first_team)