Browse Source

feat: set default encoding/charset set database on creation(pg and mysql)

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4284/head
Pranav C 2 years ago
parent
commit
8b53c2d89d
  1. 2
      packages/nocodb/src/lib/db/sql-client/lib/mysql/mysql.queries.ts
  2. 2
      packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts

2
packages/nocodb/src/lib/db/sql-client/lib/mysql/mysql.queries.ts

@ -130,7 +130,7 @@ AND t.table_name=?;`,
}, },
createDatabaseIfNotExists: { createDatabaseIfNotExists: {
default: { default: {
sql: `create database if not exists ??`, sql: `create database if not exists ?? CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci`,
paramsHints: ['database'], paramsHints: ['database'],
}, },
}, },

2
packages/nocodb/src/lib/db/sql-client/lib/pg/PgClient.ts

@ -468,7 +468,7 @@ class PGClient extends KnexClient {
} }
if (rows.length === 0) { if (rows.length === 0) {
log.debug('creating database:', args); log.debug('creating database:', args);
await tempSqlClient.raw(`CREATE DATABASE ??`, [args.database]); await tempSqlClient.raw(`CREATE DATABASE ?? ENCODING 'UTF8'`, [args.database]);
} }
// if (this.connectionConfig.searchPath && this.connectionConfig.searchPath[0]) { // if (this.connectionConfig.searchPath && this.connectionConfig.searchPath[0]) {

Loading…
Cancel
Save