From c2b11c974b717e13f15b947343c68f57101567b9 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Wed, 15 Jul 2026 19:15:33 +0900 Subject: [PATCH 1/2] fix(BA-6899): stop app_configs downgrade from creating its enum twice The downgrade created app_config_scope_type twice within itself: once explicitly via create(checkfirst=True), and again implicitly when create_table() emitted CREATE TYPE for the column typed by that same Enum. The implicit one carries no existence check, so the downgrade aborted with DuplicateObjectError every time, blocking any downgrade that has to cross this revision. Drop the explicit create() and let create_table() create the type once. upgrade() already drops the type with DROP TYPE IF EXISTS, so the pair round-trips. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../versions/84d5c6daf8cc_drop_legacy_app_configs_table.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ai/backend/manager/models/alembic/versions/84d5c6daf8cc_drop_legacy_app_configs_table.py b/src/ai/backend/manager/models/alembic/versions/84d5c6daf8cc_drop_legacy_app_configs_table.py index eb8a26fa72e..13e4e665c3a 100644 --- a/src/ai/backend/manager/models/alembic/versions/84d5c6daf8cc_drop_legacy_app_configs_table.py +++ b/src/ai/backend/manager/models/alembic/versions/84d5c6daf8cc_drop_legacy_app_configs_table.py @@ -36,7 +36,6 @@ def downgrade() -> None: # Recreate the predecessor table to allow `alembic downgrade` to # complete cleanly. Existing-row restoration is not attempted. app_config_scope_type = sa.Enum("DOMAIN", "PROJECT", "USER", name="app_config_scope_type") - app_config_scope_type.create(op.get_bind(), checkfirst=True) op.create_table( "app_configs", IDColumn(), From 18ea3a406071a139342e58accda83b36ee905b6a Mon Sep 17 00:00:00 2001 From: Gyubong Date: Wed, 15 Jul 2026 19:17:40 +0900 Subject: [PATCH 2/2] docs: add news fragment Co-Authored-By: Claude Opus 4.8 (1M context) --- changes/12887.fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/12887.fix.md diff --git a/changes/12887.fix.md b/changes/12887.fix.md new file mode 100644 index 00000000000..382995cb258 --- /dev/null +++ b/changes/12887.fix.md @@ -0,0 +1 @@ +Fix the legacy app_configs downgrade failing with a duplicate enum type error