refs #5541 Debug fixes, fetch delete id index usage fix
gitea/mylogger/pipeline/head This commit looks good
Details
gitea/mylogger/pipeline/head This commit looks good
Details
This commit is contained in:
parent
810fb55416
commit
16391f146d
10
mylogger.js
10
mylogger.js
|
@ -167,7 +167,9 @@ module.exports = class MyLogger {
|
||||||
`SELECT id FROM ${sqlTable}
|
`SELECT id FROM ${sqlTable}
|
||||||
WHERE changedModel = ?
|
WHERE changedModel = ?
|
||||||
AND changedModelId = ?
|
AND changedModelId = ?
|
||||||
AND action = 'delete'`
|
AND action = 'delete'
|
||||||
|
AND (originFk IS NULL OR originFk = ?)
|
||||||
|
LIMIT 1`
|
||||||
);
|
);
|
||||||
logInfo.updateStmt = await db.prepare(
|
logInfo.updateStmt = await db.prepare(
|
||||||
`UPDATE ${sqlTable}
|
`UPDATE ${sqlTable}
|
||||||
|
@ -542,7 +544,7 @@ module.exports = class MyLogger {
|
||||||
|
|
||||||
if (!changes.length) return;
|
if (!changes.length) return;
|
||||||
|
|
||||||
if (this.debug)
|
if (this.conf.debug)
|
||||||
console.debug('Evt:'.blue,
|
console.debug('Evt:'.blue,
|
||||||
`[${action}]`[actionColor[action]], `${tableName}: ${changes.length} changes`);
|
`[${action}]`[actionColor[action]], `${tableName}: ${changes.length} changes`);
|
||||||
|
|
||||||
|
@ -644,14 +646,14 @@ module.exports = class MyLogger {
|
||||||
: modelId;
|
: modelId;
|
||||||
|
|
||||||
let deleteRow;
|
let deleteRow;
|
||||||
if (this.debug)
|
if (this.conf.debug)
|
||||||
console.debug('Log:'.blue,
|
console.debug('Log:'.blue,
|
||||||
`[${action}]`[actionColor[action]], `${modelName}: ${modelId}`);
|
`[${action}]`[actionColor[action]], `${modelName}: ${modelId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isDelete) {
|
if (isDelete) {
|
||||||
[[deleteRow]] = await logInfo.fetchStmt.execute([
|
[[deleteRow]] = await logInfo.fetchStmt.execute([
|
||||||
modelName, modelId
|
modelName, modelId, originFk
|
||||||
]);
|
]);
|
||||||
if (deleteRow)
|
if (deleteRow)
|
||||||
await logInfo.updateStmt.execute([
|
await logInfo.updateStmt.execute([
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mylogger",
|
"name": "mylogger",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mylogger",
|
"name": "mylogger",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"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.14",
|
"version": "0.1.15",
|
||||||
"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