refactor(core): Use query builder at data table deletes (no-changelog) (#18795)

This commit is contained in:
Jaakko Husso
2025-08-26 16:49:56 +03:00
committed by GitHub
parent 71ff4d8b6b
commit d892574989
2 changed files with 8 additions and 10 deletions

View File

@@ -17,7 +17,6 @@ import {
deleteColumnQuery, deleteColumnQuery,
extractInsertedIds, extractInsertedIds,
extractReturningData, extractReturningData,
getPlaceholder,
normalizeRows, normalizeRows,
normalizeValue, normalizeValue,
quoteIdentifier, quoteIdentifier,
@@ -226,12 +225,15 @@ export class DataStoreRowsRepository {
return true; return true;
} }
const dbType = this.dataSource.options.type; const table = this.toTableName(dataStoreId);
const quotedTableName = quoteIdentifier(this.toTableName(dataStoreId), dbType);
const placeholders = ids.map((_, index) => getPlaceholder(index + 1, dbType)).join(', '); await this.dataSource
const query = `DELETE FROM ${quotedTableName} WHERE id IN (${placeholders})`; .createQueryBuilder()
.delete()
.from(table, 'dataStore')
.where({ id: In(ids) })
.execute();
await this.dataSource.query(query, ids);
return true; return true;
} }

View File

@@ -261,7 +261,3 @@ export function normalizeValue(
return value; return value;
} }
export function getPlaceholder(index: number, dbType: DataSourceOptions['type']): string {
return dbType.includes('postgres') ? `$${index}` : '?';
}