Simple SQL migration tool for SQLite and PostgreSQL


License
BSD-3-Clause
Install
pip install migranto==0.1.9

Documentation

Migranto

Simple SQL migration tool for SQLite and PostgreSQL

Instalation

pip install migranto

Migrations

All migrations exist in one directory with names like:

0001_some_useful_name.sql
0001_some_useful_name_rollback.sql
0002_some_other_useful_name.sql
0002_some_other_useful_name_rollback.sql

Migranto checks migrations directory and apply sql files to database. That's it. Simple enough.

Usage:

migranto [-h] --database URL [--storage NAME] [--name NAME]

shows migrations status

migranto [-h] --database URL --name NAME --path PATH [--migration N] [--storage NAME] [--verbose] [--fake] [--out]

  • --help, -h — show this help message and exit
  • --database URL, -d URL — database url (pgsql://user:password@host:port/dbname or sqlite://path/to/data.base)
  • --name NAME, -n NAME — migration set name
  • --path PATH, -p PATH — path to migrations dir
  • --migration N, -m N — migration step (last migration if omitted, 0 - before first migration)
  • --storage NAME, -s NAME — migranto table name for data (default is migranto)
  • --verbose, -v — verbose mode
  • --out, -o — output sql to standard output, nothing applied to database.
  • --fake, -f — fake migration (no sql applied to database, except migration number)