#!/usr/bin/env node var program = require('commander'); var utils = require('../lib/utils'); var logging = require('../logging'); var knexMigrator; utils.getKnexMigrator({path: process.cwd()}) .then(function (KnexMigrator) { program .option('--v ') .option('--only ') .option('--mgpath ') .option('--force') .option('--init') .parse(process.argv); try { knexMigrator = new KnexMigrator({knexMigratorFilePath: program.mgpath, executedFromShell: true}); } catch (err) { logging.error(err); process.exit(1); } return knexMigrator.migrate({ version: program.v, only: program.only, force: program.force, init: program.init }).then(function () { logging.info('Finished database migration!'); }); }) .catch(function (err) { logging.error(err); process.exit(1); });