From 2bb2f03c9d41982eb5963397bbe4ad613723299b Mon Sep 17 00:00:00 2001 From: "marcel.kocisek" Date: Fri, 2 Aug 2024 13:05:50 +0200 Subject: [PATCH] Fix migration for deployment with automatically created indexes --- .../c13819c566e7_migrate_away_from_jsonb_columns.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/migrations/community/c13819c566e7_migrate_away_from_jsonb_columns.py b/server/migrations/community/c13819c566e7_migrate_away_from_jsonb_columns.py index ee57cd07..81bbddf3 100644 --- a/server/migrations/community/c13819c566e7_migrate_away_from_jsonb_columns.py +++ b/server/migrations/community/c13819c566e7_migrate_away_from_jsonb_columns.py @@ -73,7 +73,16 @@ def upgrade(): op.drop_column("project_version", "changes") # harmonize constraint name - op.drop_constraint("uq_project_id_version", "project_version", type_="unique") + conn.execute( + sa.text( + "ALTER TABLE project_version DROP CONSTRAINT IF EXISTS uq_project_id_version;" + ) + ) + conn.execute( + sa.text( + "ALTER TABLE project_version DROP CONSTRAINT IF EXISTS uq_project_version_project_id;" + ) + ) # trim 'v' prefix and convert to integer conn.execute(