migrant

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'
$ migrant init --type postgres
$ migrant new create-users
apply
$ migrant apply --all

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.

Atomic

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.

Safe under concurrency

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.