#database #migration #postgresql

app asyncmigrate-cli

database migration with async support

2 unstable releases

0.2.0 Jun 25, 2022
0.1.0 Aug 17, 2020

#1073 in Database interfaces

Apache-2.0

49KB
1K SLoC

asyncmigrate-cli

Command line tool for asyncmigrate

Configuration file example

{
    "database_url": "postgres://USER:PASSWORD@HOST:PORT/DBNAME",
    "changesets": [
        {
            "group_name": "default",
            "directory": "schema"
        }
    ]
}

directory path must be absolute path or relative to config file path.

SQL file name rule

Name of SQL files must be follow a rule in below.

VERSION__NAME.sql

VERSION must be a simple number and not include dot.

Usage

setup

initialize asyncmigrate config file

asyncmigrate-cli setup

migration

Apply new SQL files

asyncmigrate-cli migrate -c config.json default

rollback

Downgrade database schema. Asyncmigrate uses SQL commands written in a database to run downgrade. If you want to update downgrade SQLs, run update-rollback-sql command first.

asyncmigrate-cli rollback -c config.json default

update-rollback-sql

Update downgrade SQL without rollback or migration.

asyncmigrate-cli update-rollback-sql -c config.json default

Dependencies

~11–17MB
~325K SLoC