npm.io
0.0.10 • Published 7 years agoCLI

dbdelta

Licence
Version
0.0.10
Deps
3
Size
82 kB
Vulns
0
Weekly
0

DBDelta

Database migrations done differently.

Overview

DBDelta is inpspired heavily by migra, for an excellent description of the concept while these docs are under development please take a look there.

Installation

npm install -g dbdelta

or

yarn global add dbdelta

Usage

All DBDelta commands take an optional --database argument, which defaults to the enironment variable DATABASE_URL.

Show the current schema
dbdelta schema
Synchronise schema

Reads a set of SQL files stored on disk and synchronises the database. Pass --show to see the SQL changes, and --commit to keep the synchronised changes. Also accepts --base <path> to specify where to find the SQL schema files (defaults to the current directory).

dbdelta schema --show --commit --base ./db
Make migrations

Creates a new migration file to carry out the necessary changes to synchonise the database. Accepts the same argumets as sync, with the addtion of --migrations <path> which specifies where to place the new migraiton.

dbdelta make --show --commit --base ./db --migrations ./db/migrations
Migrate database

Migrates the current database using made migrations. TODO

dbdelta make --base ./db --migrations ./db/migrations