8179-testToMaster #3176
|
@ -2,18 +2,7 @@ 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;
|
|
||||||
|
|
||||||
SELECT COUNT(*) INTO vItemShelvingSaleExists
|
|
||||||
FROM itemShelvingSale
|
|
||||||
WHERE itemShelvingFk = OLD.id;
|
|
||||||
|
|
||||||
IF vItemShelvingSaleExists THEN
|
|
||||||
CALL util.throw('Cannot delete item shelving with item shelving sale');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
|
|
||||||
workerFk,
|
workerFk,
|
||||||
accion,
|
accion,
|
||||||
shelvingFk,
|
shelvingFk,
|
||||||
|
@ -22,6 +11,5 @@ BEGIN
|
||||||
account.myUser_getId(),
|
account.myUser_getId(),
|
||||||
'ELIMINADO',
|
'ELIMINADO',
|
||||||
OLD.shelvingFk,
|
OLD.shelvingFk,
|
||||||
OLD.itemFk);
|
OLD.itemFk)$$
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue