DROP TRIGGER IF EXISTS `vn2008`.`ticket_afterUpdate`;

DELIMITER $$
CREATE DEFINER=`root`@`%` TRIGGER `vn2008`.`ticket_afterUpdate`
	AFTER UPDATE ON `Tickets`
    FOR EACH ROW
BEGIN
    IF !(NEW.Id_Ticket <=> OLD.Id_Ticket)
    OR !(NEW.warehouse_id <=> OLD.warehouse_id)
    OR !(NEW.Fecha <=> OLD.Fecha) THEN
		CALL stock.log_add('ticket', NEW.Id_Ticket, OLD.Id_Ticket);
	END IF;
END$$
DELIMITER ;
