refactor: refs #6824 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-10-07 07:30:36 +02:00
parent 1ae60f51dd
commit 7b4d15cb23
2 changed files with 13 additions and 22 deletions

View File

@ -2,26 +2,14 @@ DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete` CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete`
BEFORE DELETE ON `itemShelving` BEFORE DELETE ON `itemShelving`
FOR EACH ROW FOR EACH ROW
BEGIN INSERT INTO vn.itemShelvingLog(itemShelvingFk,
DECLARE vItemShelvingSaleExists BOOL; workerFk,
accion,
SELECT COUNT(*) INTO vItemShelvingSaleExists shelvingFk,
FROM itemShelvingSale itemFk)
WHERE itemShelvingFk = OLD.id; VALUES( OLD.id,
account.myUser_getId(),
IF vItemShelvingSaleExists THEN 'ELIMINADO',
CALL util.throw('Cannot delete item shelving with item shelving sale'); OLD.shelvingFk,
END IF; OLD.itemFk)$$
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
workerFk,
accion,
shelvingFk,
itemFk)
VALUES( OLD.id,
account.myUser_getId(),
'ELIMINADO',
OLD.shelvingFk,
OLD.itemFk);
END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.itemShelving DROP FOREIGN KEY itemShelving_fk2;
ALTER TABLE vn.itemShelving ADD CONSTRAINT itemShelving_fk2
FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(code) ON DELETE RESTRICT ON UPDATE CASCADE;