Skip to content

Commit d8b6e0f

Browse files
committed
fix(config): shorten default database name
closes #508 - change default dbname format to `<folder>_<environment>` rather than `ghost_<environment>_<foldername>`
1 parent c922cc5 commit d8b6e0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/commands/config/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ class ConfigCommand extends Command {
120120

121121
if (!argv.dbname) {
122122
const sanitizedDirName = path.basename(process.cwd()).replace(/[^a-zA-Z0-9_]+/g, '_');
123+
const shortenedEnv = this.system.development ? 'dev' : 'prod';
123124
prompts.push({
124125
type: 'input',
125126
name: 'dbname',
126127
message: 'Enter your Ghost database name:',
127-
default: this.instance.config.get('database.connection.database', `ghost_${this.system.environment}_${sanitizedDirName}`),
128+
default: this.instance.config.get('database.connection.database', `${sanitizedDirName}_${shortenedEnv}`),
128129
validate: (val) => !/[^a-zA-Z0-9_]/.test(val) || 'MySQL database names may consist of only alphanumeric characters and underscores.'
129130
});
130131
}

0 commit comments

Comments
 (0)