Change wording

This commit is contained in:
Jim Laurie 2018-01-10 18:08:43 +01:00
parent b17d1a29b2
commit df5b9f3dab
4 changed files with 13 additions and 11 deletions

View File

@ -9,11 +9,13 @@ const logger = require('strapi-utils').logger;
module.exports = (scope, success, error) => {
const knex = require(`${scope.rootPath}_/node_modules/knex`)({
client: scope.client.module,
connection: scope.database
connection: Object.assign(scope.database, {
user: scope.database.username
})
});
knex.raw('select 1+1 as result').then(() => {
logger.info('Database connection is a success!');
logger.info('The app has been connected to the database successfully');
knex.destroy();
execSync(`rm -r ${scope.rootPath}_`);
@ -22,7 +24,7 @@ module.exports = (scope, success, error) => {
success();
})
.catch(() => {
logger.warn('Database connection failed!');
logger.warn('Database connection has failed! Make sure your database is running.');
error();
});
};

View File

@ -53,7 +53,7 @@ module.exports = (scope, cb) => {
scope.database = {};
const connectionValidation = () => {
const databaseChoises = [
const databaseChoices = [
{
name: 'MongoDB (highly recommended)',
value: {
@ -100,11 +100,11 @@ module.exports = (scope, cb) => {
type: 'list',
prefix: '',
name: 'client',
message: 'Choose your database:',
choices: databaseChoises,
message: 'Choose your main database:',
choices: databaseChoices,
default: () => {
if (scope.client) {
return _.findIndex(databaseChoises, { value: _.omit(scope.client, ['version'])});
return _.findIndex(databaseChoices, { value: _.omit(scope.client, ['version'])});
}
}
}

View File

@ -11,11 +11,11 @@ module.exports = (scope, success, error) => {
Mongoose.connect(`mongodb://${ (scope.database.username && scope.database.password) ? `${scope.database.username}:${scope.database.password}@` : '' }${scope.database.host}:${scope.database.port}/${scope.database.database}`, function (err) {
if (err) {
logger.warn('Database connection failed!');
logger.warn('Database connection has failed! Make sure your database is running.');
return error();
}
logger.info('Database connection is a success!');
logger.info('The app has been connected to the database successfully!');
Mongoose.connection.close();

View File

@ -19,11 +19,11 @@ module.exports = (scope, success, error) => {
redis.disconnect();
if (err) {
logger.warn('Database connection failed!');
logger.warn('Database connection has failed! Make sure your database is running.');
return error();
}
logger.info('Database connection is a success!');
logger.info('The app has been connected to the database successfully!');
execSync(`rm -r ${scope.rootPath}_`);