8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
2 changed files with 31 additions and 35 deletions
Showing only changes of commit 3cf5555612 - Show all commits

View File

@ -8,6 +8,7 @@ BEGIN
DECLARE vSchemaName VARCHAR(65);
DECLARE vTableName VARCHAR(65);
DECLARE vRetentionDays INT;
DECLARE vStarted DATETIME;
DECLARE vDated DATE;
DECLARE vDone BOOL;
@ -23,28 +24,23 @@ BEGIN
SET vDone = FALSE;
FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
IF vDone THEN
LEAVE l;
END IF;
IF vRetentionDays THEN
UPDATE logCleanMultiConfig
SET `started` = util.VN_NOW()
WHERE schemaName = vSchemaName
AND tableName = vTableName;
SET vSchemaName = util.quoteIdentifier(vSchemaName);
SET vTableName = util.quoteIdentifier(vTableName);
SET vStarted = util.VN_NOW();
SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
IF vDone THEN
LEAVE l;
END IF;
CALL util.exec(CONCAT(
'DELETE FROM ', vSchemaName , '.', vTableName,
'DELETE FROM ', util.quoteIdentifier(vSchemaName),
'.', util.quoteIdentifier(vTableName),
" WHERE creationDate < '", vDated, "'"
));
UPDATE logCleanMultiConfig
SET `finished` = util.VN_NOW()
SET `started` = vStarted,
`finished` = VN_NOW()
WHERE schemaName = vSchemaName
AND tableName = vTableName;
END IF;

View File

@ -8,25 +8,25 @@ CREATE OR REPLACE TABLE `util`.`logCleanMultiConfig` (
PRIMARY KEY (`schemaName`,`tableName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO `util`.`logCleanMultiConfig` (`schemaName`, `tableName`, `retentionDays`, `order`)
INSERT INTO `util`.`logCleanMultiConfig` (`schemaName`, `tableName`)
VALUES
('account', 'roleLog', 'xxx', NULL),
('account', 'userLog', 'xxx', NULL),
('vn', 'entryLog', 'xxx', NULL),
('vn', 'clientLog', 'xxx', NULL),
('vn', 'itemLog', 'xxx', NULL),
('vn', 'shelvingLog', 'xxx', NULL),
('vn', 'workerLog', 'xxx', NULL),
('vn', 'deviceProductionLog', 'xxx', NULL),
('vn', 'zoneLog', 'xxx', NULL),
('vn', 'rateLog', 'xxx', NULL),
('vn', 'ticketLog', 'xxx', NULL),
('vn', 'agencyLog', 'xxx', NULL),
('vn', 'userLog', 'xxx', NULL),
('vn', 'routeLog', 'xxx', NULL),
('vn', 'claimLog', 'xxx', NULL),
('vn', 'supplierLog', 'xxx', NULL),
('vn', 'invoiceInLog', 'xxx', NULL),
('vn', 'travelLog', 'xxx', NULL),
('vn', 'packingSiteDeviceLog', 'xxx', NULL),
('vn', 'parkingLog', 'xxx', NULL);
('account', 'roleLog' ),
('account', 'userLog' ),
('vn', 'entryLog' ),
('vn', 'clientLog' ),
('vn', 'itemLog' ),
('vn', 'shelvingLog' ),
('vn', 'workerLog' ),
('vn', 'deviceProductionLog' ),
('vn', 'zoneLog' ),
('vn', 'rateLog' ),
('vn', 'ticketLog' ),
('vn', 'agencyLog' ),
('vn', 'userLog' ),
('vn', 'routeLog' ),
('vn', 'claimLog' ),
('vn', 'supplierLog' ),
('vn', 'invoiceInLog' ),
('vn', 'travelLog' ),
('vn', 'packingSiteDeviceLog' ),
('vn', 'parkingLog' );