Skip to content

Commit 5bccc83

Browse files
vzakharovclaude
andcommitted
fix: correct constraint name in migration 040 upgrade/downgrade
Migration 040 tried to drop `generations_match_id_fkey`, but on prod (and any DB upgrading through 039 for the first time) the constraint is still named `fk_generations_match_id_matches` — the original name from migration 025 that 039 drops and recreates under the same name. The mismatch happened because the previous fix (08baebc) queried the dev DB to resolve `None` constraint names, but dev was already at head, so the names reflected the post-040 state rather than the pre-040 state. Fix: use the actual constraint name that exists after 039 runs (`fk_generations_match_id_matches`) in both upgrade() drop and downgrade() create, so the migration chain is consistent end-to-end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b803c71 commit 5bccc83

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

alembic/versions/040_fix_generation_fks_to_cascade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def upgrade() -> None:
2323
op.f("generations_chat_id_fkey"), "generations", type_="foreignkey"
2424
)
2525
op.drop_constraint(
26-
op.f("generations_match_id_fkey"), "generations", type_="foreignkey"
26+
"fk_generations_match_id_matches", "generations", type_="foreignkey"
2727
)
2828
op.create_foreign_key(
2929
op.f("generations_match_id_fkey"),
@@ -52,7 +52,7 @@ def downgrade() -> None:
5252
"generations_chat_id_fkey", "generations", type_="foreignkey"
5353
)
5454
op.create_foreign_key(
55-
op.f("generations_match_id_fkey"),
55+
"fk_generations_match_id_matches",
5656
"generations",
5757
"matches",
5858
["match_id"],

0 commit comments

Comments
 (0)