From 7fdfd92a1cf673cdfc40568c64cc0199ba1406cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 19 Aug 2020 13:13:16 +0200 Subject: [PATCH] Removed sql --- .../10210-summer/00-ticket_beforeUpdate.sql | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 db/changes/10210-summer/00-ticket_beforeUpdate.sql diff --git a/db/changes/10210-summer/00-ticket_beforeUpdate.sql b/db/changes/10210-summer/00-ticket_beforeUpdate.sql deleted file mode 100644 index fa1cb6c5f..000000000 --- a/db/changes/10210-summer/00-ticket_beforeUpdate.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP TRIGGER IF EXISTS `vn`.`ticket_beforeUpdate`; - -DELIMITER $$ -USE `vn`$$ -CREATE DEFINER=`root`@`%` TRIGGER `ticket_beforeUpdate` - BEFORE UPDATE ON `ticket` - FOR EACH ROW -BEGIN - IF !(NEW.shipped <=> OLD.shipped) THEN - IF YEAR(NEW.shipped) < 2000 THEN - SIGNAL SQLSTATE '46000' - SET MESSAGE_TEXT = 'Year cannot be lesser than 2000'; - END IF; - - IF YEAR(NEW.shipped) = 2000 THEN - SET NEW.isDeleted = TRUE; - END IF; - END IF; - - IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN - SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); - SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); - SET NEW.routeFk = NULL; - SET NEW.zoneFk = NULL; - END IF; - - IF NEW.routeFk AND NEW.isDeleted THEN - CALL util.throw ('This ticket is deleted'); - END IF; -END$$ -DELIMITER ;