refactor: refs #6496 Deleted clean vn2008 #2104

Merged
guillermo merged 5 commits from 6496-cleanVn2008 into dev 2024-03-04 10:58:07 +00:00
2 changed files with 24 additions and 27 deletions
Showing only changes of commit 7a43ccaa36 - Show all commits

View File

@ -1,10 +1,6 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`clean`()
BEGIN
DECLARE vDateShort DATETIME;
SET vDateShort = util.VN_CURDATE() - INTERVAL 1 MONTH;
DELETE FROM cache.departure_limit WHERE Fecha < vDateShort;
DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH;
END$$
DELIMITER ;
guillermo marked this conversation as resolved Outdated

millor v1Month com en el altre clean

millor v1Month com en el altre clean

View File

@ -82,7 +82,7 @@ BEGIN
DELETE c
FROM claim c
JOIN claimState cs ON cs.id = c.claimStateFk
WHERE cs.description = "Anulado"
WHERE cs.description = 'Anulado'
guillermo marked this conversation as resolved Outdated

cometes simples

cometes simples
AND c.created < v2Months;
DELETE FROM expeditionTruck WHERE eta < v3Months;
@ -94,7 +94,8 @@ BEGIN
FROM travel t
LEFT JOIN entry e ON e.travelFk = t.id
JOIN travelThermograph th ON th.travelFk = t.id
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
WHERE t.shipped < v3Months
guillermo marked this conversation as resolved Outdated

formato fecha

formato fecha
AND e.travelFk IS NULL;
SELECT dt.id INTO vTrashId
FROM dmsType dt
@ -111,12 +112,12 @@ BEGIN
DELETE t
FROM travel t
guillermo marked this conversation as resolved
Review

indentació LEFT

indentació LEFT
LEFT JOIN entry e ON e.travelFk = t.id
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
WHERE t.shipped < v3Months AND e.travelFk IS NULL;
UPDATE dms d
JOIN dmsType dt ON dt.id = d.dmsTypeFk
SET d.dmsTypeFk = vTrashId
WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE());
WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH;
-- borrar entradas sin compras
CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete
@ -124,7 +125,8 @@ BEGIN
FROM entry e
LEFT JOIN buy b ON b.entryFk = e.id
JOIN entryConfig ec ON e.id <> ec.defaultEntry
guillermo marked this conversation as resolved Outdated

formato fecha

formato fecha
WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL;
WHERE e.dated < v3Months
AND b.entryFK IS NULL;
DELETE e
FROM entry e
@ -134,7 +136,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete
SELECT *
guillermo marked this conversation as resolved Outdated

formato fecha

formato fecha
FROM route r
WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE());
WHERE created < v4Years;
UPDATE tRouteToDelete tmp
JOIN dms d ON d.id = tmp.gestdocFk
@ -148,7 +150,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tDuaToDelete
SELECT *
guillermo marked this conversation as resolved Outdated

formato fecha

formato fecha
FROM dua
WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE());
WHERE operated < v2Years;
UPDATE tDuaToDelete tm
JOIN dms d ON d.id = tm.gestdocFk
@ -175,7 +177,6 @@ BEGIN
JOIN ticket t ON tt.ticketFk = t.id
WHERE t.shipped <= v2Months;
guillermo marked this conversation as resolved
Review

eliminar comentario

eliminar comentario
-- Clean vn2008
DELETE FROM mail WHERE creationDate < v2Months;
DELETE FROM split WHERE dated < v18Months;
DELETE FROM remittance WHERE dated < v18Months;