#!/usr/bin/env node var program = require('commander'); var utils = require('../lib/utils'); var logging = require('@tryghost/logging'); var knexMigrator; utils.getKnexMigrator({path: process.cwd()}) .then(function (KnexMigrator) { program .option('--mgpath ') .parse(process.argv); try { knexMigrator = new KnexMigrator({knexMigratorFilePath: program.mgpath, executedFromShell: true}); } catch (err) { logging.error(err); process.exit(1); } return knexMigrator.isDatabaseOK() .then(function () { logging.info('Woohoo, Database is healthy'); }); }) .catch(function (err) { logging.error(err.message); if (err.help) { logging.info(err.help); } process.exit(1); });