From 622075a9aa41c22673b1b8828d4ce22747c954d7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 Apr 2024 09:21:34 +0200 Subject: [PATCH 1/5] fix(util): refs #7205 fix util.slowLog_prune --- db/routines/util/procedures/slowLog_prune.sql | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/db/routines/util/procedures/slowLog_prune.sql b/db/routines/util/procedures/slowLog_prune.sql index 7294be2f6..8e8aec30f 100644 --- a/db/routines/util/procedures/slowLog_prune.sql +++ b/db/routines/util/procedures/slowLog_prune.sql @@ -6,11 +6,19 @@ BEGIN */ DECLARE vSlowQueryLog INT DEFAULT @@slow_query_log; DECLARE vSqlLogBin INT DEFAULT @@SESSION.sql_log_bin; + DECLARE vLogExists BOOL; SET sql_log_bin = OFF; SET GLOBAL slow_query_log = OFF; - RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + SELECT COUNT(*) INTO vLogExists + FROM information_schema.TABLES + WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'slow_log'; + + IF vLogExists THEN + DROP TEMPORARY TABLE IF EXISTS `mysql`.`slow_log_temp`; + RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + END IF; DELETE FROM `mysql`.`slow_log_temp` WHERE start_time < TIMESTAMPADD(WEEK, -1, util.VN_NOW()); From ccf77ed356bfb24ec80d11ea6546458d59d8c81f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 Apr 2024 09:24:48 +0200 Subject: [PATCH 2/5] fix(util): refs #7205 util.slowLog_prune code clean --- db/routines/util/procedures/slowLog_prune.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/util/procedures/slowLog_prune.sql b/db/routines/util/procedures/slowLog_prune.sql index 8e8aec30f..d676ae3d9 100644 --- a/db/routines/util/procedures/slowLog_prune.sql +++ b/db/routines/util/procedures/slowLog_prune.sql @@ -11,19 +11,19 @@ BEGIN SET sql_log_bin = OFF; SET GLOBAL slow_query_log = OFF; - SELECT COUNT(*) INTO vLogExists + SELECT COUNT(*) > 0 INTO vLogExists FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'slow_log'; IF vLogExists THEN - DROP TEMPORARY TABLE IF EXISTS `mysql`.`slow_log_temp`; - RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + DROP TEMPORARY TABLE IF EXISTS mysql.slow_log_temp; + RENAME TABLE mysql.slow_log TO mysql.slow_log_temp; END IF; - DELETE FROM `mysql`.`slow_log_temp` + DELETE FROM mysql.slow_log_temp WHERE start_time < TIMESTAMPADD(WEEK, -1, util.VN_NOW()); - RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; + RENAME TABLE mysql.slow_log_temp TO mysql.slow_log; SET GLOBAL slow_query_log = vSlowQueryLog; SET sql_log_bin = vSqlLogBin; From b4862a8ce94dc86223967b38bc20da393841eeb5 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 12 Apr 2024 11:35:21 +0200 Subject: [PATCH 3/5] hotFix(claimBegginingModel): enable claimIsEditable and && --- modules/claim/back/models/claim-beginning.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/claim/back/models/claim-beginning.js b/modules/claim/back/models/claim-beginning.js index 4b870e5ea..d269b2285 100644 --- a/modules/claim/back/models/claim-beginning.js +++ b/modules/claim/back/models/claim-beginning.js @@ -19,7 +19,7 @@ module.exports = Self => { if (ticket.ticketFk != claim.ticketFk) throw new UserError(`Cannot create a new claimBeginning from a different ticket`); } - // await claimIsEditable(ctx); + await claimIsEditable(ctx); }); Self.observe('before delete', async ctx => { @@ -36,7 +36,7 @@ module.exports = Self => { if (ctx.options && ctx.options.transaction) myOptions.transaction = ctx.options.transaction; - const claimBeginning = await Self.findById(ctx.where.id); + const claimBeginning = ctx.instance ?? await Self.findById(ctx.where.id); const filter = { where: {id: claimBeginning.claimFk}, From 42fe7fb1e23e47cf6b07d846dd0ea57a3f1e9481 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 15 Apr 2024 11:32:44 +0200 Subject: [PATCH 4/5] feat(binlog): refs #4409 Disable order recalc from triggers --- db/routines/hedera/events/order_doRecalc.sql | 2 +- db/routines/hedera/procedures/order_requestRecalc.sql | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/routines/hedera/events/order_doRecalc.sql b/db/routines/hedera/events/order_doRecalc.sql index d355e1a55..bbc61924f 100644 --- a/db/routines/hedera/events/order_doRecalc.sql +++ b/db/routines/hedera/events/order_doRecalc.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `hedera`.`order_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2019-08-29 14:18:04.000' ON COMPLETION PRESERVE - ENABLE + DISABLE DO CALL order_doRecalc$$ DELIMITER ; diff --git a/db/routines/hedera/procedures/order_requestRecalc.sql b/db/routines/hedera/procedures/order_requestRecalc.sql index 4bcb1010e..990894bb6 100644 --- a/db/routines/hedera/procedures/order_requestRecalc.sql +++ b/db/routines/hedera/procedures/order_requestRecalc.sql @@ -10,6 +10,7 @@ proc: BEGIN LEAVE proc; END IF; - INSERT INTO orderRecalc SET orderFk = vSelf; + -- #4409 Disable order recalc + -- INSERT INTO orderRecalc SET orderFk = vSelf; END$$ DELIMITER ; From 7fda58d4a4fef14dcd557c90fa7be07caadcf122 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 16 Apr 2024 12:29:44 +0200 Subject: [PATCH 5/5] hotfix: ticket#174308 Ekt load packing --- db/routines/edi/procedures/ekt_load.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/edi/procedures/ekt_load.sql b/db/routines/edi/procedures/ekt_load.sql index ccdcd1999..adbaf4628 100644 --- a/db/routines/edi/procedures/ekt_load.sql +++ b/db/routines/edi/procedures/ekt_load.sql @@ -147,7 +147,7 @@ proc:BEGIN (@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue, IFNULL(vItem, vDefaultEntry) itemFk, e.qty stickers, - @pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing, + @pac := GREATEST(1, i.stemMultiplier * e.pac / @t) packing, IFNULL(b.`grouping`, e.pac), @pac * e.qty, vForceToPacking,