Browse Source

fix: handle more than 64 options for mysql

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3937/head
mertmit 2 years ago
parent
commit
1cfbdb2e83
  1. 12
      packages/nocodb/src/lib/meta/api/columnApis.ts
  2. 14
      packages/nocodb/src/lib/meta/api/sync/helpers/job.ts

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

@ -605,6 +605,12 @@ export async function columnAdd(req: Request, res: Response<TableType>) {
) {
colBody.dtxp = "''";
}
if (colBody.dt === 'set') {
if (colBody.colOptions?.options.length > 64) {
colBody.dt = 'text';
}
}
}
}
@ -901,6 +907,12 @@ export async function columnUpdate(req: Request, res: Response<TableType>) {
) {
colBody.dtxp = "''";
}
if (colBody.dt === 'set') {
if (colBody.colOptions?.options.length > 64) {
colBody.dt = 'text';
}
}
}
// Handle option delete

14
packages/nocodb/src/lib/meta/api/sync/helpers/job.ts

@ -577,11 +577,15 @@ export default async (
ncCol.colOptions = {
options: [...colOptions.data],
};
// if options are empty, configure '' as default option
ncCol.dtxp =
colOptions.data
.map((el) => `'${el.title.replace(/'/gi, "''")}'`)
.join(',') || "''";
if (['mysql', 'mysql2'].includes(getRootDbType())) {
// if options are empty, configure '' as an option
ncCol.dtxp =
colOptions.data
.map((el) => `'${el.title.replace(/'/gi, "''")}'`)
.join(',') || "''";
}
break;
case undefined:
break;

Loading…
Cancel
Save