Postgres DB migration tool, written in rust 🦀
Download source from here
project
│ README.md
└───migrations
│ │ 1_some.up.sql
| | 1_some.down.sql
│ │ 2_second.up.sql
| | 2_second.down.sql
│ │
└───folder2
│ file021.txt
│ file022.txt
more info on structure
{number_filename.{type(up|down)}.sql}
1_init.up.sql
1_init.down.sql
you can refer this folder
First you need to have migrations table in database, query can be found here
Commands to run
migration_type=down ./target/release/db_migraiton.exe
optionally it uses DB_URL as
postgresql://postgres:postgres@localhost/migration-test
you can override by writing following command
migration_type=down DB_URL=postgresql://postgres:postgres@localhost/migration-test ./target/release/db_migraiton.exe
optionally it uses migration_path as follows
migration_path=src/migrations
you can also override migration_path folder path as follows
migration_type=down migration_path=src/scripts/migration_path ./target/release/db_migraiton.exe
you can provide schema for migration table, buy default it uses public schema.
migration_type=up schema=public cargo run