Merge pull request 'feat: refs #8357 Agregados triggers para manejar exclusiones de trabajadores en la tabla workerMana' (!3341) from 8357-workerManaExcludedTriggers into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3341 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
2572182a89
|
@ -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 ;
|
|
@ -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 ;
|
|
@ -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 ;
|
|
@ -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 ;
|
|
@ -0,0 +1,5 @@
|
|||
DELETE FROM vn.workerMana
|
||||
WHERE workerFk IN (
|
||||
SELECT workerFk
|
||||
FROM vn.workerManaExcluded
|
||||
);
|
Loading…
Reference in New Issue