migrant
node-migrant ============
Last updated 6 years ago by runk .
Original npm · Tarball · package.json
$ cnpm install migrant 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.1.1                                ...           latest (6 years ago)

3 Versions

  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 2
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |