From 262c30a4d5fa92074f2892854c83377059c0f866 Mon Sep 17 00:00:00 2001 From: Sergey Golitsynskiy Date: Thu, 20 Jan 2022 23:11:17 -0500 Subject: [PATCH] Wrap drop_table in db revision 180 in try/except --- .../model/migrate/versions/0180_add_vault_table.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/model/migrate/versions/0180_add_vault_table.py b/lib/galaxy/model/migrate/versions/0180_add_vault_table.py index 3006e90c74b..d3671ccd559 100644 --- a/lib/galaxy/model/migrate/versions/0180_add_vault_table.py +++ b/lib/galaxy/model/migrate/versions/0180_add_vault_table.py @@ -22,4 +22,12 @@ def upgrade(migrate_engine): def downgrade(migrate_engine): meta.bind = migrate_engine - vault.drop() + # This revision is not part of 21.09, but in 22.01 it will be handled by Alembic. + # It is possible to reach a state (via upgrading/downgrading) where this table + # will have been dropped by Alembic, but SQLAlchemy Migrate (our previous + # db migrations tool) will have version 180 (which includes this table). + # Downgrading from such a state would raise an error - which this code prevents. + try: + vault.drop() + except Exception: + pass