1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix: deletion of rows with non-numeric ID

This commit is contained in:
2020-12-07 15:07:59 +01:00
parent e0e2131981
commit d38583262e
2 changed files with 22 additions and 11 deletions

View File

@ -89,11 +89,18 @@ export default (connections) => {
});
ipcMain.handle('delete-table-rows', async (event, params) => {
let idString;
if (typeof params.rows[0] === 'string')
idString = params.rows.map(row => `"${row}"`).join(',');
else
idString = params.rows.join(',');
try {
const result = await connections[params.uid]
.schema(params.schema)
.delete(params.table)
.where({ [params.primary]: `IN (${params.rows.join(',')})` })
.where({ [params.primary]: `IN (${idString})` })
.run();
return { status: 'success', response: result };