diff --git a/.env.example b/.env.example index d7da084a6..751e66314 100644 --- a/.env.example +++ b/.env.example @@ -30,6 +30,7 @@ DB_TABLE_PREFIX= # DB_USER=nocobase # DB_PASSWORD=nocobase # DB_LOGGING=on +# DB_UNDERSCORED=true ################# CACHE ################# # default is memory cache, when develop mode,code's change will be clear memory cache, so can use 'cache-manager-fs-hash' diff --git a/packages/core/server/src/application.ts b/packages/core/server/src/application.ts index 077beff83..4a4f71ede 100644 --- a/packages/core/server/src/application.ts +++ b/packages/core/server/src/application.ts @@ -482,8 +482,8 @@ export class Application exten if (this.db.inDialect('mysql')) { const result = await this.db.sequelize.query(`SHOW VARIABLES LIKE 'lower_case_table_names'`, { plain: true }); - if (result?.Value === '1') { - console.log(chalk.red(`mysql variable 'lower_case_table_names' must be set to '0' or '2'`)); + if (result?.Value === '1' && !this.db.options.underscored) { + console.log(`Your database lower_case_table_names=1, please add ${chalk.yellow('DB_UNDERSCORED=true')} to the .env file`); if (options?.exit) { process.exit(); }