Abstract Migrator class. This class should be be instantiated directly.

Constructor

Defined migration.js Source
  1. function (db,directory,opts){
  2. this.db = db;
  3. this.directory = directory;
  4. opts = opts || {};
  5. this.table = opts.table || this._static.DEFAULT_SCHEMA_TABLE;
  6. this.column = opts.column || this._static.DEFAULT_SCHEMA_COLUMN;
  7. this._opts = opts;
  8. }

run Static Function Public


Defined migration.js

Migrates the database using migration files found in the supplied directory. See patio#migrate

Example
  1. var DB = patio.connect("my://connection/string");
  2. patio. migrate(DB, __dirname + "/timestamp_migration").chain(function(){
  3. console.log("done migrating!");
  4. });
  5.  
  6. patio. migrate(DB, __dirname + "/timestamp_migration", {target : 0}).chain(function(){
  7. console.log("done migrating down!");
  8. });
Arguments Returns Source
  1. function (db,directory,opts,cb){
  2. if (isFunction(opts)) {
  3. cb = opts;
  4. opts = {};
  5. } else {
  6. opts = opts || {};
  7. }
  8. opts = opts || {};
  9. return this.__getMigrator(directory).chain(function (Migrator) {
  10. return new Migrator(db, directory, opts).run();
  11. }).classic(cb);
  12. }

run Function Public


Defined migration.js

Runs the migration and returns a promise.

Source
  1. function (){
  2. throw new NotImplemented("patio.migrations.Migrator#run");
  3. }

Documentation generated using coddoc.