salix/db/versions/.archive/10245-yellowRaphis/00-firstScript.sql

7 lines
452 B
MySQL
Raw Permalink Normal View History

ALTER TABLE `vn`.`travel` ADD agencyModeFk INT DEFAULT NULL NULL;
ALTER TABLE `vn`.`travel` ADD CONSTRAINT travel_FK FOREIGN KEY (agencyModeFk) REFERENCES `vn`.`agencyMode`(id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE `vn`.`travel` ADD CONSTRAINT shipment_1 UNIQUE KEY (shipped,landed,warehouseInFk,warehouseOutFk,agencyFk,agencyModeFk,`ref`);
ALTER TABLE `vn`.`travel` DROP KEY shipment_2;
UPDATE `vn`.`travel`
SET agencyModeFk = agencyFk;