feat: refs #8357 Agregados triggers para manejar exclusiones de trabajadores en la tabla workerMana
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2025-01-07 11:58:36 +01:00
parent b1dda9f82b
commit 065f13557b
5 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerManaExcluded_beforeInsert`
BEFORE INSERT ON `workerManaExcluded`
FOR EACH ROW
BEGIN
DELETE FROM workerMana
WHERE workerFk = NEW.workerFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerManaExcluded_beforeUpdate`
BEFORE UPDATE ON `workerManaExcluded`
FOR EACH ROW
BEGIN
DELETE FROM workerMana
WHERE workerFk = NEW.workerFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,10 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerMana_beforeInsert`
BEFORE INSERT ON `workerMana`
FOR EACH ROW
BEGIN
IF (SELECT EXISTS(SELECT TRUE FROM workerManaExcluded WHERE workerFk = NEW.workerFk)) THEN
CALL util.throw('Worker is excluded from mana');
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,10 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerMana_beforeUpdate`
BEFORE UPDATE ON `workerMana`
FOR EACH ROW
BEGIN
IF (SELECT EXISTS(SELECT TRUE FROM workerManaExcluded WHERE workerFk = NEW.workerFk)) THEN
CALL util.throw('Worker is excluded from mana');
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,5 @@
DELETE FROM vn.workerMana
WHERE workerFk IN (
SELECT workerFk
FROM vn.workerManaExcluded
);