#!/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('--skip ') .option('--only ') .option('--mgpath ') .parse(process.argv); try { knexMigrator = new KnexMigrator({knexMigratorFilePath: program.mgpath, executedFromShell: true}); } catch (err) { logging.error(err); process.exit(1); } return knexMigrator.init({ skip: program.skip, only: program.only }).then(function () { logging.info('Finished database init!'); }); }) .catch(function (err) { logging.error(err); process.exit(1); });