Skip to content
Latchkey

alembic current: Show the Applied Revision

alembic current prints the revision id stored in the database, letting you confirm it matches the latest head.

current is the read-only status command. Compare it against alembic heads to know whether the database is up to date.

What it does

alembic current reads the alembic_version table and prints the current revision id, with (head) appended if it is the latest. alembic heads prints the head revision(s) in the code, and alembic history lists the full chain.

Common usage

Terminal
alembic current
# e.g. "ae1027a6acf (head)"

# compare current to heads in CI
[ "$(alembic current | awk '{print $1}')" = "$(alembic heads | awk '{print $1}')" ] \
  || echo "database is behind head"

Options

Command / flagWhat it does
currentPrint the revision the database is at
headsPrint the latest revision(s) in the code
historyPrint the full revision chain
--verboseInclude more detail per revision

In CI

Run alembic current in a check job and compare it to alembic heads to assert the database is fully migrated. It is read-only. If current prints nothing, the alembic_version table is empty and no migrations have run yet.

Common errors in CI

"Can't locate revision identified by 'X'" from current means the database records a revision whose file is missing from the code, often after a rebase dropped a migration; restore it or use alembic stamp. "Multiple head revisions are present" from heads means a branch needs a merge revision before upgrade head will work cleanly.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →