Skip to content

fix(migrations): correct down_revision chain for json_to_jsonb migration#307

Merged
IonesioJunior merged 1 commit intomainfrom
fix/migration-down-revision-chain
Mar 4, 2026
Merged

fix(migrations): correct down_revision chain for json_to_jsonb migration#307
IonesioJunior merged 1 commit intomainfrom
fix/migration-down-revision-chain

Conversation

@IonesioJunior
Copy link
Member

Summary

  • 006_json_to_jsonb referenced 005_otp_requester_ip as its down_revision, but that revision does not exist in the codebase
  • This caused Alembic to crash with a KeyError during startup, failing the Deploy to production stage in CI
  • Fixed by pointing down_revision to the actual chain head: 003_encryption_key

Root cause

The migration was authored on a branch that had diverged from main and referenced local revisions (004_*, 005_otp_requester_ip) that were never merged.

Chain after fix

001_initial002_api_tokens003_encryption_key006_json_to_jsonb

Test plan

  • CI migration check passes (Alembic resolves full history without errors)
  • Deploy to production stage completes successfully

006_json_to_jsonb referenced non-existent revision 005_otp_requester_ip,
causing Alembic to crash with a KeyError during deploy. The actual chain
head is 003_encryption_key.
@IonesioJunior IonesioJunior merged commit 3c5cb5f into main Mar 4, 2026
25 checks passed
@IonesioJunior IonesioJunior deleted the fix/migration-down-revision-chain branch March 4, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant