|
|
@ -935,17 +935,30 @@ export async function columnUpdate(req: Request, res: Response<TableType>) { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
await dbDriver.raw( |
|
|
|
if (colBody.dt === 'set') { |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), ',')) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
await dbDriver.raw( |
|
|
|
[ |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), ',')) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
table.table_name, |
|
|
|
[ |
|
|
|
column.column_name, |
|
|
|
table.table_name, |
|
|
|
column.column_name, |
|
|
|
column.column_name, |
|
|
|
option.title, |
|
|
|
column.column_name, |
|
|
|
option.title, |
|
|
|
option.title, |
|
|
|
column.column_name, |
|
|
|
option.title, |
|
|
|
] |
|
|
|
column.column_name, |
|
|
|
); |
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await dbDriver.raw( |
|
|
|
|
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), ','))`, |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
table.table_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
option.title, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if (driverType === 'pg') { |
|
|
|
} else if (driverType === 'pg') { |
|
|
|
await dbDriver.raw( |
|
|
|
await dbDriver.raw( |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_remove(string_to_array(??, ','), ?), ',')`, |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_remove(string_to_array(??, ','), ?), ',')`, |
|
|
@ -1101,18 +1114,31 @@ export async function columnUpdate(req: Request, res: Response<TableType>) { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
await dbDriver.raw( |
|
|
|
if (colBody.dt === 'set') { |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ','))) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
await dbDriver.raw( |
|
|
|
[ |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ','))) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
table.table_name, |
|
|
|
[ |
|
|
|
column.column_name, |
|
|
|
table.table_name, |
|
|
|
column.column_name, |
|
|
|
column.column_name, |
|
|
|
option.title, |
|
|
|
column.column_name, |
|
|
|
newOp.title, |
|
|
|
option.title, |
|
|
|
option.title, |
|
|
|
newOp.title, |
|
|
|
column.column_name, |
|
|
|
option.title, |
|
|
|
] |
|
|
|
column.column_name, |
|
|
|
); |
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await dbDriver.raw( |
|
|
|
|
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ',')))`, |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
table.table_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
option.title, |
|
|
|
|
|
|
|
newOp.title, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}
|
|
|
|
} else if (driverType === 'pg') { |
|
|
|
} else if (driverType === 'pg') { |
|
|
|
await dbDriver.raw( |
|
|
|
await dbDriver.raw( |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_replace(string_to_array(??, ','), ?, ?), ',')`, |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_replace(string_to_array(??, ','), ?, ?), ',')`, |
|
|
@ -1174,18 +1200,33 @@ export async function columnUpdate(req: Request, res: Response<TableType>) { |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
} else if (column.uidt === UITypes.MultiSelect) { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
if (driverType === 'mysql' || driverType === 'mysql2') { |
|
|
|
await dbDriver.raw( |
|
|
|
if (colBody.dt === 'set') { |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ','))) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
await dbDriver.raw( |
|
|
|
[ |
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ','))) WHERE FIND_IN_SET(?, ??)`, |
|
|
|
table.table_name, |
|
|
|
[ |
|
|
|
column.column_name, |
|
|
|
table.table_name, |
|
|
|
column.column_name, |
|
|
|
column.column_name, |
|
|
|
ch.temp_title, |
|
|
|
column.column_name, |
|
|
|
newOp.title, |
|
|
|
ch.temp_title, |
|
|
|
ch.temp_title, |
|
|
|
newOp.title, |
|
|
|
column.column_name, |
|
|
|
ch.temp_title, |
|
|
|
] |
|
|
|
column.column_name, |
|
|
|
); |
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await dbDriver.raw( |
|
|
|
|
|
|
|
`UPDATE ?? SET ?? = TRIM(BOTH ',' FROM REPLACE(CONCAT(',', ??, ','), CONCAT(',', ?, ','), CONCAT(',', ?, ',')))`, |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
table.table_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
ch.temp_title, |
|
|
|
|
|
|
|
newOp.title, |
|
|
|
|
|
|
|
ch.temp_title, |
|
|
|
|
|
|
|
column.column_name, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
} else if (driverType === 'pg') { |
|
|
|
} else if (driverType === 'pg') { |
|
|
|
await dbDriver.raw( |
|
|
|
await dbDriver.raw( |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_replace(string_to_array(??, ','), ?, ?), ',')`, |
|
|
|
`UPDATE ?? SET ?? = array_to_string(array_replace(string_to_array(??, ','), ?, ?), ',')`, |
|
|
|