Track
Plain up.sql/down.sql files under version
control, applied in order and recorded in a
__migrant_migrations table. SQLite, PostgreSQL, and MySQL,
from the CLI or embedded in your Rust app.
up/down SQL migrations for SQLite, PostgreSQL, and MySQL. Each migration is atomic and concurrent runs serialize behind an advisory lock. Use the CLI, or embed it in your Rust app.
$ cargo install migrant --features 'postgres sqlite mysql update'
↗ github.com/jaemk/migrant/releases
Open
$ docker run --rm jaemk/migrant:latest migrant --help
$ migrant init --type postgres
$ migrant new create-users
$ migrant apply --all
Plain up.sql/down.sql files under version
control, applied in order and recorded in a
__migrant_migrations table. SQLite, PostgreSQL, and MySQL,
from the CLI or embedded in your Rust app.
Each migration and its bookkeeping row commit or roll back in one
transaction, so a failure leaves no partial state. Opt a direction out
with -- migrant:no-transaction for DDL a backend cannot run
in a transaction.
Runs against a server database take a session advisory lock, so several
app instances applying migrations on boot serialize instead of racing.
Held across a --force run, released if the process dies.