#9694 update structure db

This commit is contained in:
Bernat 2019-02-01 12:40:48 +01:00
parent 19d8a2c98c
commit e5f91079c8
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
DROP TRIGGER IF EXISTS `vn2008`.`expeditionsBeforeDelete`;
DELIMITER $$
USE `vn2008`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`expeditionsBeforeDelete`
BEFORE DELETE ON `expeditions` FOR EACH ROW
BEGIN
UPDATE Tickets SET Bultos = (SELECT COUNT(counter)-1
FROM expeditions WHERE ticket_id = OLD.ticket_id and EsBulto)
WHERE Id_Ticket = OLD.ticket_id;
END$$
DELIMITER ;