From fa7d2c2c3f58501dd01c13e2658a2e2e759a0d81 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 20 May 2020 16:46:02 +0100 Subject: [PATCH] Adding a commit at the end of each migration file. The assumption that a commit is issued in between migration files was false. This will force the db connection to commit, the alter table commands will complete and the alembic version updated. --- migrations/versions/0321_update_postage_constraint_1.py | 1 + migrations/versions/0322_update_postage_constraint_2.py | 1 + 2 files changed, 2 insertions(+) diff --git a/migrations/versions/0321_update_postage_constraint_1.py b/migrations/versions/0321_update_postage_constraint_1.py index 15d7f27d5..53f9d2ea2 100644 --- a/migrations/versions/0321_update_postage_constraint_1.py +++ b/migrations/versions/0321_update_postage_constraint_1.py @@ -30,6 +30,7 @@ def upgrade(): """) if environment not in ["live", "production"]: op.execute('ALTER TABLE notification_history DROP CONSTRAINT IF EXISTS chk_notification_history_postage_null') + op.execute('COMMIT') def downgrade(): diff --git a/migrations/versions/0322_update_postage_constraint_2.py b/migrations/versions/0322_update_postage_constraint_2.py index 9fbfdac5b..c5bd1b630 100644 --- a/migrations/versions/0322_update_postage_constraint_2.py +++ b/migrations/versions/0322_update_postage_constraint_2.py @@ -38,6 +38,7 @@ def upgrade(): ) NOT VALID """) + op.execute('COMMIT') def downgrade():