migrant

0.1.1 • Public • Published

node-migrant

Data agnostic migrations

Installation

npm install migrant

Usage

var Migrant = require('migrant'),
  MetaFile = require('migrant/lib/meta/file');
 
module.exports = new Migrant({
  dir: __dirname + '/migrations', // directory with migration files
  meta: new MetaFile({path: __dirname + '/migrant.json'}) // meta information storage
});
 
module.exports.run();

You can specify your custom store of meta data, e.g.:

var Migrant = require('migrant'),
  meta = {};
 
// Meta Storage has very basic interface:
var storage = {
  get: function(cb) { cb(null, meta) },
  set: function(value, cb) { meta = value; cb() }
};
 
 
module.exports = new Migrant({
  dir: __dirname + '/migrations',
  meta: storage // custom storage
});
 
module.exports.run();

Using with npm

You can put a special task in package.json file:

{
  "name": "my-project",
  "scripts": {
    "migrate": "node migrant.js"
  }
}

and then you be able to do npm run migrate. Another option is to add shebang to the migrant executable and run it in a manual way.

Cli interface

  Usage: migrant.js [options]

  Options:

    -h, --help  output usage information
    --up      Migrate up
    --down    Migrate down
    --create  Create empty migration file
    --count   Migrate particular number of migration
    --revert  Revert last migration

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    1
  • 0.1.0
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i migrant

Weekly Downloads

3

Version

0.1.1

License

none

Last publish

Collaborators

  • runk