Add MariaDB queue table. Fix Bugs
This commit is contained in:
Vendored
+5
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user