https://github.com/hivesolutions/migratore
SQL based migration system with migration management
https://github.com/hivesolutions/migratore
database migrations mysql sql
Last synced: 6 months ago
JSON representation
SQL based migration system with migration management
- Host: GitHub
- URL: https://github.com/hivesolutions/migratore
- Owner: hivesolutions
- Created: 2014-02-07T16:10:54.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2024-01-09T14:53:15.000Z (over 2 years ago)
- Last Synced: 2025-03-01T15:41:45.046Z (over 1 year ago)
- Topics: database, migrations, mysql, sql
- Language: Python
- Homepage: http://migratore.hive.pt
- Size: 259 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# [](http://migratore.hive.pt)
Simple migration framework / infra-structure for SQL-based databases.
## Installation
```bash
pip install migratore
```
## Execution
```bash
HOST=${HOST} DB=${DB_NAME} USERNAME=${DB_USER} PASSWORD=${DB_PASS} migratore upgrade
```
## Variables
* `HOST` - Hostname or IP address of the database system for migration
* `PORT` - TCP port to be used in the connection with the database system
* `UNIX_SOCKET` - Filesystem path to the UNIX socket file to be used in connection
* `DB` - Name of the database used as the migration target
* `USERNAME` - Username for authentication in the database
* `PASSWORD` - Password to be used for authentication in the database
* `FS` - Base file system path for file migration (may depend on migration context)
* `DB_URL` - The database connection URL following the format `protocol://username:password@host:port/db`
* `SAFE` - If the migration operation should be performed in a safe manner.
## Commands
* `help` - Prints a help message about the CLI interface
* `version` - Prints the current version of migratore
* `environ` - Displays the current environment in the standard output
* `list` - Lists the executed migrations on the current database
* `errors` - Lists the various errors from migration of the database
* `mark` - Marks the associated data source with the current timestamp
* `trace [id]` - Prints the traceback for the error execution with the provided id
* `rebuild [id]` - Run the partial execution of the migration with the given id
* `touch [id]` - Touches a migration file updating its timestamp to the current time
* `squash [start] [end] ` - Combines multiple migrations into a single file
* `upgrade [path]` - Executes the pending migrations using the defined directory or current
* `dry_upgrade [path]` - Prints the pending migrations without executing them
* `skip [path]` - Skips the current migration (next to be run) using the defined directory or current
* `generate [path]` - Generates a new migration file into the target path
## Examples
```python
database = Migratore.get_database()
table = database.get_table("users")
table.add_column("username", type = "text")
```
## License
Migratore is currently licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/).
## Build Automation
[](https://github.com/hivesolutions/migratore/actions)
[](https://coveralls.io/r/hivesolutions/migratore?branch=master)
[](https://pypi.python.org/pypi/migratore)
[](https://www.apache.org/licenses/)