Removed sql
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-08-19 13:13:16 +02:00
parent f0818acf32
commit 7fdfd92a1c
1 changed files with 0 additions and 31 deletions

View File

@ -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 ;