refs #5541 Constraint fail error ignored
gitea/mylogger/pipeline/head This commit looks good
Details
gitea/mylogger/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6bc39209d0
commit
e06f8fafee
55
mylogger.js
55
mylogger.js
|
@ -639,31 +639,38 @@ module.exports = class MyLogger {
|
||||||
|
|
||||||
let deleteRow;
|
let deleteRow;
|
||||||
|
|
||||||
if (isDelete) {
|
try {
|
||||||
[[deleteRow]] = await logInfo.fetchStmt.execute([
|
if (isDelete) {
|
||||||
modelName, modelId
|
[[deleteRow]] = await logInfo.fetchStmt.execute([
|
||||||
]);
|
modelName, modelId
|
||||||
if (deleteRow)
|
|
||||||
await logInfo.updateStmt.execute([
|
|
||||||
originFk,
|
|
||||||
created,
|
|
||||||
oldInstance,
|
|
||||||
modelValue,
|
|
||||||
deleteRow.id
|
|
||||||
]);
|
]);
|
||||||
}
|
if (deleteRow)
|
||||||
if (!isDelete || !deleteRow) {
|
await logInfo.updateStmt.execute([
|
||||||
await logInfo.addStmt.execute([
|
originFk,
|
||||||
originFk,
|
created,
|
||||||
row[tableInfo.userField] || null,
|
oldInstance,
|
||||||
action,
|
modelValue,
|
||||||
created,
|
deleteRow.id
|
||||||
modelName,
|
]);
|
||||||
oldInstance,
|
}
|
||||||
newI ? JSON.stringify(newI) : null,
|
if (!isDelete || !deleteRow) {
|
||||||
modelId,
|
await logInfo.addStmt.execute([
|
||||||
modelValue
|
originFk,
|
||||||
]);
|
row[tableInfo.userField] || null,
|
||||||
|
action,
|
||||||
|
created,
|
||||||
|
modelName,
|
||||||
|
oldInstance,
|
||||||
|
newI ? JSON.stringify(newI) : null,
|
||||||
|
modelId,
|
||||||
|
modelValue
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code == 'ER_NO_REFERENCED_ROW_2') {
|
||||||
|
this.debug('Log', `Ignored because of constraint failed.`);
|
||||||
|
} else
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mylogger",
|
"name": "mylogger",
|
||||||
"version": "0.1.11",
|
"version": "0.1.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mylogger",
|
"name": "mylogger",
|
||||||
"version": "0.1.11",
|
"version": "0.1.12",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mylogger",
|
"name": "mylogger",
|
||||||
"version": "0.1.11",
|
"version": "0.1.12",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "MySQL and MariaDB logger using binary log",
|
"description": "MySQL and MariaDB logger using binary log",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue