Skip to content

fairy-select/chronovoyage

Repository files navigation

ChronoVoyage

PyPI - Version PyPI - Python Version PyPI - License Package Health | Snyk

logo

Chronovoyage is a simple database migration framework.

Visit Documentation


Table of Contents

Simple Usage

To use MariaDB version, you need the MariaDB development package (libmariadb-dev in apt).

pip install chronovoyage[mariadb]

Usage

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

Contributing

Please read the following docs before you contribute to this repo:

Security Policy

We support the latest version based on GitHub's vulnerability alerts.

Security Policy

License

chronovoyage is distributed under the terms of the MIT license.

License

Roadmap

  • Support for
    • Python 3.8 or later
    • Docker
  • Database support
    • MariaDB
    • MySQL
    • PostgreSQL
  • Migration file support
    • SQL (.sql)
    • Shell script (.sh)
  • Commands
    • new init
      • Create migration directory and config file
    • generate add
      • 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
    • status current
      • 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