lib/cli/actions.js
function(action, azulfile, options, strings) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));
  var message = '';
  var batches = '';

  return migrator[action]()
  .tap(function(migrations) {
    batches = _(migrations).pluck('batch').unique().join(', ');
  })
  .then(function(migrations) {
    message += migrations.length ?
      chalk.magenta(strings.intro, 'migrations, batch', batches, '\n') :
      chalk.magenta(strings.none, '\n');
    migrations.forEach(function(migration) {
      message += chalk.cyan(migration.name, '\n');
    });
    message += chalk.gray(_.capitalize(env), 'environment\n');
    process.stdout.write(message);
  })
  .catch(function(e) {
    message += chalk.red(strings.action, 'failed.', e);
    process.stderr.write(message);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
}
function(action, azulfile, options, strings) {
  var db = Database.create(azulfile[env]);
  var migrator = db.migrator(path.resolve(options.migrations));
  var message = '';
  var batches = '';

  return migrator[action]()
  .tap(function(migrations) {
    batches = _(migrations).pluck('batch').unique().join(', ');
  })
  .then(function(migrations) {
    message += migrations.length ?
      chalk.magenta(strings.intro, 'migrations, batch', batches, '\n') :
      chalk.magenta(strings.none, '\n');
    migrations.forEach(function(migration) {
      message += chalk.cyan(migration.name, '\n');
    });
    message += chalk.gray(_.capitalize(env), 'environment\n');
    process.stdout.write(message);
  })
  .catch(function(e) {
    message += chalk.red(strings.action, 'failed.', e);
    process.stderr.write(message);
    process.exit(1);
  })
  .finally(function() { db.disconnect(); });
}
function ( action , azulfile , options , strings ) { var db = Database . create ( azulfile [ env ] ) ; var migrator = db . migrator ( path . resolve ( options . migrations ) ) ; var message = '' ; var batches = '' ; return migrator [ action ] ( ) . tap ( function ( migrations ) { batches = _ ( migrations ) . pluck ( 'batch' ) . unique ( ) . join ( ', ' ) ; } ) . then ( function ( migrations ) { message += migrations . length ? chalk . magenta ( strings . intro , 'migrations, batch' , batches , '\n' ) : chalk . magenta ( strings . none , '\n' ) ; migrations . forEach ( function ( migration ) { message += chalk . cyan ( migration . name , '\n' ) ; } ) ; message += chalk . gray ( _ . capitalize ( env ) , 'environment\n' ) ; process . stdout . write ( message ) ; } ) . catch ( function ( e ) { message += chalk . red ( strings . action , 'failed.' , e ) ; process . stderr . write ( message ) ; process . exit ( 1 ) ; } ) . finally ( function ( ) { db . disconnect ( ) ; } ) ; }
Run the migrator.

@private
@function runMigrator
@param {String} action Either `migrate` or `rollback`.
@param {Object} azulfile Configuration object.
@param {Object} options
@param {String} options.migrations
@param {Object} strings The output format strings to use.
@return {Promise}
Run the migrator .