48 lines
1.4 KiB
MySQL
48 lines
1.4 KiB
MySQL
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD COLUMN `isOk` TINYINT(1) NULL DEFAULT NULL AFTER `odbc_date`,
|
||
|
ADD COLUMN `requesterFk` INT(11) NULL DEFAULT NULL AFTER `isOk`,
|
||
|
ADD COLUMN `atenderFk` INT(11) NULL DEFAULT NULL AFTER `requesterFk`;
|
||
|
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD COLUMN `ticketFk` INT(11) NULL DEFAULT NULL AFTER `atenderFk`;
|
||
|
|
||
|
|
||
|
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD INDEX `fgnRequester_idx` (`requesterFk` ASC),
|
||
|
ADD INDEX `fgnAtender_idx` (`atenderFk` ASC);
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD CONSTRAINT `fgnRequester`
|
||
|
FOREIGN KEY (`requesterFk`)
|
||
|
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE,
|
||
|
ADD CONSTRAINT `fgnAtender`
|
||
|
FOREIGN KEY (`atenderFk`)
|
||
|
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE,
|
||
|
ADD CONSTRAINT `fgbMovimiento`
|
||
|
FOREIGN KEY (`Id_Movimiento`)
|
||
|
REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE;
|
||
|
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
DROP FOREIGN KEY `fgbMovimiento`;
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD CONSTRAINT `fgbMovimiento`
|
||
|
FOREIGN KEY (`Id_Movimiento`)
|
||
|
REFERENCES `vn2008`.`Movimientos` (`Id_Movimiento`)
|
||
|
ON DELETE SET NULL
|
||
|
ON UPDATE CASCADE;
|
||
|
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD INDEX `fgnTicket_idx` (`ticketFk` ASC);
|
||
|
ALTER TABLE `vn2008`.`Ordenes`
|
||
|
ADD CONSTRAINT `fgnTicket`
|
||
|
FOREIGN KEY (`ticketFk`)
|
||
|
REFERENCES `vn2008`.`Tickets` (`Id_Ticket`)
|
||
|
ON DELETE RESTRICT
|
||
|
ON UPDATE CASCADE;
|