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 ;