salix/db/versions/.archive/10370-pinkBirch/04-inter.sql

35 lines
1.5 KiB
SQL

RENAME TABLE `vn`.`ticketTracking` TO `vn`.`ticketTracking__`;
DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_beforeInsert`;
DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterInsert`;
DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterUpdate`;
DROP TRIGGER IF EXISTS `vncontrol`.`ticketTracking_afterDelete`;
ALTER TABLE `vncontrol`.`inter` RENAME `vn`.`ticketTracking`;
ALTER TABLE vn.ticketTracking CHANGE nota notes varchar(255) DEFAULT NULL NULL;
ALTER TABLE vn.ticketTracking CHANGE inter_id id int(11) auto_increment NOT NULL;
ALTER TABLE vn.ticketTracking CHANGE state_id stateFk tinyint(3) unsigned NOT NULL;
ALTER TABLE vn.ticketTracking CHANGE fallo_id failFk int(10) unsigned DEFAULT 21 NOT NULL;
ALTER TABLE vn.ticketTracking CHANGE odbc_date created timestamp DEFAULT current_timestamp() NULL;
ALTER TABLE vn.ticketTracking CHANGE Id_Ticket ticketFk int(11) DEFAULT NULL NULL;
ALTER TABLE vn.ticketTracking CHANGE Id_Trabajador workerFk int(11) DEFAULT NULL NULL;
ALTER TABLE vn.ticketTracking CHANGE Id_Supervisor supervisorFk int(10) unsigned DEFAULT NULL NULL;
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`localhost`
SQL SECURITY DEFINER
VIEW `vncontrol`.`inter` AS
SELECT
`tt`.`id` AS `inter_id`,
`tt`.`stateFk` AS `state_id`,
`tt`.`failFk` AS `fallo_id`,
`tt`.`notes` AS `nota`,
`tt`.`created` AS `odbc_date`,
`tt`.`ticketFk` AS `Id_Ticket`,
`tt`.`workerFk` AS `Id_Trabajador`,
`tt`.`supervisorFk` AS `Id_Supervisor`
FROM
`vn`.`ticketTracking` `tt`;