Add MariaDB queue table. Fix Bugs

This commit is contained in:
2026-10-18 15:58:02 +01:00
parent d872c3661a
commit f9ba5f8657
28 changed files with 785 additions and 49 deletions
+5 -1
View File
@@ -2,6 +2,7 @@ import dbHandler from "../db-handler";
import _ from "lodash";
import sqlGenerator from "../../utils/sql-generator";
import { quoteIdentifier } from "../../utils/sql-identifier";
import { isQueueTable, QUEUE_NOT_CLAIMED_SQL } from "../queue/queue-utils";
export default async function DbDelete({ table, query, targetId, config, }) {
let sqlObj = null;
try {
@@ -11,7 +12,7 @@ export default async function DbDelete({ table, query, targetId, config, }) {
genObject: finalQuery,
targetId,
});
const whereClause = sqlObj.where;
let whereClause = sqlObj.where;
if (!whereClause) {
return {
success: false,
@@ -21,6 +22,9 @@ export default async function DbDelete({ table, query, targetId, config, }) {
},
};
}
if (isQueueTable(table)) {
whereClause += ` AND ${QUEUE_NOT_CLAIMED_SQL}`;
}
let sql = `DELETE FROM ${quoteIdentifier(table)} ${whereClause}`;
sql += ` RETURNING *`;
sqlObj.string = sql;