Skip to content

CICD-307 · Alembic migration ​

Encyclopedia · Database delivery and migration · All snippets

Previous · CICD-306 · Next · CICD-308

1. Where it fits ​

  • Placement CI run step.
  • Prerequisites disposable database, migration tools and a scoped database role.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
alembic heads
alembic upgrade head
alembic current --check-heads

3. How it works ​

The migration CLI compares the configured revision graph with the target database and applies or checks the selected revisions.

4. Verify the result ​

Use Alembic with check-heads support and a disposable database. Fail when multiple unintended heads exist.

Validation syntax-validated (Bash parse). Status definitions.