Browse Source

refactor(nocodb): use sqlClient

pull/5131/head
Wing-Kam Wong 2 years ago
parent
commit
055264a96e
  1. 4
      packages/nocodb/src/lib/meta/api/columnApis.ts
  2. 8
      packages/nocodb/src/lib/meta/api/tableApis.ts

4
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -655,9 +655,9 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
const base = await Base.get(table.base_id);
const dbDriver = NcConnectionMgrv2.get(base);
const sqlClient = await NcConnectionMgrv2.getSqlClient(base);
const sqlClientType = dbDriver.clientType();
const sqlClientType = sqlClient.knex.clientType();
const mxColumnLength = Column.getMaxColumnNameLength(sqlClientType);

8
packages/nocodb/src/lib/meta/api/tableApis.ts

@ -151,12 +151,8 @@ export async function tableCreate(req: Request<any, any, TableReqType>, res) {
const sqlClient = await NcConnectionMgrv2.getSqlClient(base);
const dbDriver = NcConnectionMgrv2.get(base);
const sqlClientType = dbDriver.clientType();
let tableNameLengthLimit = 255;
const sqlClientType = sqlClient.knex.clientType();
if (sqlClientType === 'mysql2' || sqlClientType === 'mysql') {
tableNameLengthLimit = 64;
} else if (sqlClientType === 'pg') {
@ -313,7 +309,7 @@ export async function tableUpdate(req: Request<any, any>, res) {
const sqlClient = await NcConnectionMgrv2.getSqlClient(base);
let tableNameLengthLimit = 255;
const sqlClientType = sqlClient.clientType;
const sqlClientType = sqlClient.knex.clientType();
if (sqlClientType === 'mysql2' || sqlClientType === 'mysql') {
tableNameLengthLimit = 64;
} else if (sqlClientType === 'pg') {

Loading…
Cancel
Save