Merge branch '142993479-tags' of ssh://github.com/coralproject/talk into 142993479-tags

This commit is contained in:
Chi Vinh Le
2017-06-09 00:24:48 +07:00
+5 -37
View File
@@ -12,7 +12,6 @@ const MODERATION_OPTIONS = require('../models/enum/moderation_options');
const SettingsService = require('../services/settings');
const SetupService = require('../services/setup');
const UsersService = require('../services/users');
const MigrationService = require('../services/migration');
const util = require('./util');
const errors = require('../errors');
@@ -36,15 +35,6 @@ program
const performSetup = async () => {
if (program.defaults) {
await SettingsService.init();
console.log('Settings created.');
console.log('\nTalk is now installed!');
return;
}
// Get the current settings, we are expecing an error here.
try {
@@ -64,35 +54,13 @@ const performSetup = async () => {
}
}
// Get the migrations to run.
let migrations = await MigrationService.listPending();
if (migrations.length > 0) {
if (program.defaults) {
await SettingsService.init();
console.log('Now going to run the following migrations:\n');
console.log('Settings created.');
console.log('\nTalk is now installed!');
for (let {filename} of migrations) {
console.log(`\tmigrations/${filename}`);
}
console.log('');
let {confirm} = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Proceed with migrations',
default: false
}
]);
if (!confirm) {
throw new Error('migrations are needed to complete setup');
}
// Perform all migrations.
await MigrationService.run(migrations);
} else {
console.log('No migrations have to be run.');
return;
}
// Create the base settings model.