Simple SQL migration manager for your project.
Dmitriy Pleshevskiy
f98dd4f0c8
I added a single transaction option for apply, upgrade, and downgrade commands, which wraps all migrations into a single transaction. This gives you the ability to safely roll up migrations and, if some unforeseen situation occurs, roll them back. Unfortunately if there is an error in syntax, mysql will not rollback the migration and commits automatically :( I will research this issue. Closes #2 |
||
---|---|---|
.github | ||
.vscode | ||
migra-cli | ||
sample | ||
.env.sample | ||
.gitignore | ||
Cargo.toml | ||
CODE_OF_CONDUCT.md | ||
docker-compose.yml | ||
LICENSE_APACHE | ||
LICENSE_MIT | ||
README.md |
Migra
Simple SQL migration manager for your project.
Install
cargo install migra-cli
If you want to use dotenv for configure migra cli, just run the following in your terminal.
cargo install migra-cli --features dotenv
Each supported database is located in separate features with a similar name.
The default is postgres
.
For example, if you only want to work with mysql
, you need to disable postgres
and enable mysql
.
cargo install migra-cli --no-default-features --features mysql
Usage
A few steps to get you started
- Initialize migra configuration (Optional)
migra init
- Make your first migration
migra make initial_migration
- Check applied and pending migrations
migra ls
- Upgrade your database
migra up
For more information about the commands, simply run migra help
Supported databases
- Postgres
- MySQL
License
Licensed under either of these:
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)