mizzle
Simple migrations. CLI and JS API. DB Agnostic.
Usage
CLI
Usage: migrate [options] [command]
Commands:
apply [migration] apply all unapplied migrations or just [migration]
reverse [migration] reverse all applied migrations or just [migration]
create [name] create a new migration file with optional [name]
list [options] list migrations and whether they have been applied
Options:
-h, --help output usage information
-V, --version output the version number
-p, --path <path> Path to migrations (default: migrations)
-s, --storage <path> Path to storage module
Javascript
var Migration = Migration; ;
Migrations
Migrations export apply(callback)
and reverse(callback)
functions.
Create migrations using migrate create [name]
. Migrations are modules kept in
the migrations path and have file names prefixed with a timestamp for ordering.
Example:
moduleexports = { // ... ; } { // ... ; };
Storage module
Store which migrations have been applied in your DB by specifying a
--storage
module.
A storage module exports methods get(callback)
and set(applied, callback)
where applied
is an array of the migrations applied.
The default storage module persists to disk at [path]/.applied
.