A tool to create and manage SQL migrations.
Every call to dbmigrate requires 2 arguments: database url and migrations folder.
Those can be set through environment variables: DBMIGRATE_URL
and DBMIGRATE_PATH
or as args to a call. Argument will override an environment variable.
```bash
dbmigrate --url postgres://.. --path ./migrations create my_name
dbmigrate --url postgres://.. --path ./migrations up
dbmigrate --url postgres://.. --path ./migrations down
dbmigrate --url postgres://.. --path ./migrations redo
dbmigrate --url postgres://.. --path ./migrations revert
dbmigrate --url postgres://.. --path ./migrations status ```
The format of the migration files is the following:
bash
0001.initial_db.up.sql
0001.initial_db.down.sql
You can also pass a string to create
and dbmigrate will slugify it for you:
```bash dbmigrate --url postgres://.. --path ./migrations create "change currency table"
0001.changecurrencytable.up.sql 0001.changecurrencytable.down.sql ```
.
(dot) is not allowed in a migration name as it is the filename separator character.
0.2.3: don't panic on invalid files in migration folder & ssl support for postgres 0.2.2: slugify migration names and check if they are ok
This is heavily inspired by https://github.com/mattes/migrate.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.