Chronovoyage is a simple database migration framework.
To use MariaDB version, you need the MariaDB development package (libmariadb-dev
in apt).
pip install chronovoyage[mariadb]
First, you should name and initialize a directory.
chronovoyage init my-project --vendor mariadb
cd my-project
Edit config.json
.
{
"$schema": "https://raw.githubusercontent.com/fairy-select/chronovoyage/main/schema/config.schema.json",
"vendor": "mariadb",
"connection_info": {
"host": "127.0.0.1",
"port": 3306,
"user": "mariadb",
"password": "password",
"database": "test"
}
}
Create migration template directory.
chronovoyage add ddl initial_migration
If you create DML,
chronovoyage add dml second_migration
Write up sql to go.sql
, and rollback sql to return.sql
.
Then, migrate.
chronovoyage migrate
Please read the following docs before you contribute to this repo:
We support the latest version based on GitHub's vulnerability alerts.
chronovoyage
is distributed under the terms of the MIT license.
- Support for
- Python 3.8 or later
- Docker
- Database support
- MariaDB
- MySQL
- PostgreSQL
- Migration file support
- SQL (.sql)
- Shell script (.sh)
- Commands
newinit- Create migration directory and config file
generateadd- Create migration files from template
- migrate
- To latest
- To specific version
- From the beginning
- From the middle
- --dry-run
- Show executing SQL
- Detect ddl or dml
statuscurrent- Show current migration status
- rollback
- To version
- test
- Check if every "migrate -> rollback" operation means do nothing for schema
- If dml, the operation means do nothing for data (including autoincrement num)
- Other
- CLI logging
- Documentation