From 3463b8fcb15976b2488fab3366e84f23fd8e1b74 Mon Sep 17 00:00:00 2001 From: Pako Date: Wed, 21 Feb 2024 12:09:52 +0100 Subject: [PATCH] done --- db/routines/vn/procedures/clean.sql | 1 + db/versions/10898-6906-workerActivity/00-table.sql | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 db/versions/10898-6906-workerActivity/00-table.sql diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 7b561cfe0..65045bcbd 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -22,6 +22,7 @@ BEGIN SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; + DELETE FROM workerActivity WHERE created < v2Years; DELETE FROM ticketParking WHERE created < vDateShort; DELETE FROM routesMonitor WHERE dated < vDateShort; DELETE FROM workerTimeControlLog WHERE created < vDateShort; diff --git a/db/versions/10898-6906-workerActivity/00-table.sql b/db/versions/10898-6906-workerActivity/00-table.sql new file mode 100644 index 000000000..ec517b929 --- /dev/null +++ b/db/versions/10898-6906-workerActivity/00-table.sql @@ -0,0 +1,13 @@ +-- Place your SQL code here +CREATE TABLE vn.workerActivity ( +id INT PRIMARY KEY AUTO_INCREMENT, +created TIMESTAMP DEFAULT CURRENT_TIMESTAMP, +model ENUM('COM', 'ENT', 'TPV', 'ENC', 'LAB', 'ETI') NOT NULL, +workerFk INT(10) UNSIGNED NOT NULL, +event ENUM('open', 'close', 'insert', 'delete', 'update', 'refresh') NOT NULL, +description VARCHAR(255) DEFAULT NULL, +CONSTRAINT fk_workerActivity_worker FOREIGN KEY (workerFk) + REFERENCES vn.worker (id) + ON DELETE CASCADE + ON UPDATE CASCADE +); \ No newline at end of file