update structure table ticketLog
This commit is contained in:
parent
6ae781cc98
commit
1718952fcf
|
@ -0,0 +1,17 @@
|
||||||
|
DROP TRIGGER IF EXISTS `vn`.`ticketLog_AFTER_INSERT`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
USE `vn`$$
|
||||||
|
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`ticketLog_AFTER_INSERT` AFTER INSERT ON `ticketLog` FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
DECLARE vActionId INT DEFAULT 84;
|
||||||
|
DECLARE vWorkerFk INT;
|
||||||
|
|
||||||
|
SELECT id INTO vWorkerFk
|
||||||
|
FROM worker w
|
||||||
|
WHERE w.userFk = NEW.userFk;
|
||||||
|
|
||||||
|
INSERT INTO vn2008.Tickets_dits(idaccion_dits,Id_Trabajador,Id_Ticket,value_old,value_new)
|
||||||
|
VALUES (vActionId, vWorkerFk, NEW.originFk, NULL, NULL);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,10 @@
|
||||||
|
ALTER TABLE `vn`.`ticketLog`
|
||||||
|
DROP FOREIGN KEY `ticketLog_ibfk_2`;
|
||||||
|
ALTER TABLE `vn`.`ticketLog`
|
||||||
|
CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NULL DEFAULT NULL ;
|
||||||
|
ALTER TABLE `vn`.`ticketLog`
|
||||||
|
ADD CONSTRAINT `ticketLog_ibfk_2`
|
||||||
|
FOREIGN KEY (`userFk`)
|
||||||
|
REFERENCES `account`.`user` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
|
@ -0,0 +1,10 @@
|
||||||
|
ALTER TABLE `vn2008`.`Tickets_dits`
|
||||||
|
DROP FOREIGN KEY `fgkey3`;
|
||||||
|
ALTER TABLE `vn2008`.`Tickets_dits`
|
||||||
|
CHANGE COLUMN `Id_Trabajador` `Id_Trabajador` INT(11) NULL DEFAULT NULL ;
|
||||||
|
ALTER TABLE `vn2008`.`Tickets_dits`
|
||||||
|
ADD CONSTRAINT `fgkey3`
|
||||||
|
FOREIGN KEY (`Id_Trabajador`)
|
||||||
|
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE CASCADE;
|
Loading…
Reference in New Issue