Basic migration manager powered by
||Enable postgres connectivity|
||Enable sqlite connectivity|
||Enable mysql connectivity|
migrant will manage all migrations that live under
project-dir is the closest
parent path that contains a
Migrant.toml configuration file (
The default migration file location can be modified in your
Migrant.toml file (
migration_location directory doesn't exist, it will be created the first time you create a new migration.
migrant stores all applied migrations in a database table named
Note: SQL statements are batch executed as is. If you want your migration to happen atomically in a
transaction you must manually wrap your statements in a transaction (
begin transaction; ... commit;).
See releases for binaries. If you've already installed a binary release, you can update to the latest release via
migrant self update.
Building from source:
migrant will build without any features, falling back to using each database's
mysql database driver libraries can be activated with their respective feature flags.
Note, Some drivers require their dev libraries (
Self update functionality (updating to the latest GitHub release) is available behind the
The binary releases are built with all features.
Building from source (
# install without features # use cli commands for all db interaction cargo install migrant # install with `postgres` cargo install migrant --features postgres # install with `rusqlite` cargo install migrant --features sqlite # all cargo install migrant --features 'postgres sqlite mysql update'
migrant init [--type <database-type>, --location <project-dir>, --no-confirm] - Initialize project by creating a
Migrant.toml file with db info/credentials.
When run interactively (without
setup will be run automatically.
migrant setup - Verify database info/credentials and setup a
__migrant_migrations table if missing.
migrant new <tag> - Generate new up & down files with the given
<tag> under the specified
migrant edit <tag> [--down] - Edit the
down] migration file with the given
migrant list - Display all available .sql files and mark those applied.
migrant apply [--down, --all, --force, --fake] - Apply the next available migration[s].
migrant shell - Open a repl
migrant which-config - Display the full path of the
Migrant.toml file being used
migrant connect-string - Display either the connection-string generated from config-params or the database-path for sqlite
migrant self update - Update to the latest version released on GitHub.
migrant self bash-completions install [--path <path>] - Generate a bash completion script and save it to the default or specified path.
Usage as a library
An image with the binary installed is available at