FIX revert alembic version#1726
Merged
hannahwestra25 merged 3 commits intoMay 13, 2026
Merged
Conversation
rlundeen2
approved these changes
May 13, 2026
…ra/fix-migration-chain
fb023cd to
b534c59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
alembic migration chain broken for any existing database because the migration
108a72344872(add_labels_to_attack_results) was deleted and it's columns squashed— plus new error/retry columns — directly into the initial schema (e373726d391b)Any database that had already run migrations is stamped at revision
108a72344872in thealembic_versiontable. Since that revision file no longer exists, alembic throws:Can't locate revision identified by '108a72344872'This breaks all integration tests and any existing user or CI database.
Why this approach
Restore the deleted migration + create a new one (this PR)
108a72344872makes existing databases immediately functional again.108a72344872) simply run the new migration to get error columns. Fresh DBs run all three migrations in order. Option 2 would require existing DBs to first recognize a revision they've never seen, adding fragile re-stamping logic.Changes
e373726d391b_initial_schema.py108a72344872_add_labels_to_attack_results.pylabelstoAttackResultEntries)7a1b2c3d4e5f_add_error_retry_fields.pyAttackResultEntriesandScenarioResultEntriesFinal migration chain:
e373726d391b→108a72344872→7a1b2c3d4e5fTesting
test_migration.py— 16/16 passedtest_sqlite_memory.py+test_azure_sql_memory.py— 73 passed, 1 skippedenforce_alembic_revision_immutability.py— passed