salix/db/versions/.archive/10119-navyGerbera/01-AfegirFkPart2.sql

17 lines
1.8 KiB
MySQL
Raw Permalink Normal View History

/*
ALTER TABLE cache.last_buy ADD CONSTRAINT last_buy_FK_1 FOREIGN KEY (warehouse_id) REFERENCES vn.warehouse(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE cache.last_buy MODIFY COLUMN buy_id int(11) NULL;
-- Aplicado hasta aquí
ALTER TABLE cache.last_buy ADD CONSTRAINT last_buy_FK_2 FOREIGN KEY (buy_id) REFERENCES vn.buy(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE cache.prod_graphic_source MODIFY COLUMN warehouse_id smallint(6) unsigned NOT NULL;
ALTER TABLE cache.prod_graphic_source ADD CONSTRAINT prod_graphic_source_FK FOREIGN KEY (warehouse_id) REFERENCES vn.warehouse(id) ON DELETE CASCADE ON UPDATE CASCADE;
DELETE FROM dipole.expedition_PrintOut WHERE expeditionFk NOT IN (SELECT id FROM vn.expedition);
ALTER TABLE dipole.expedition_PrintOut ADD CONSTRAINT expedition_PrintOut_FK_1 FOREIGN KEY (expeditionFk) REFERENCES vn.expedition(id);
ALTER TABLE dipole.expedition_PrintOut ADD CONSTRAINT expedition_PrintOut_FK_2 FOREIGN KEY (addressFk) REFERENCES vn.address(id);
ALTER TABLE dipole.expedition_PrintOut ADD CONSTRAINT expedition_PrintOut_FK_3 FOREIGN KEY (clientFk) REFERENCES vn.client(id);
ALTER TABLE dipole.expedition_PrintOut MODIFY COLUMN routeFk int(11) DEFAULT 0 NOT NULL COMMENT '3 ultimos caracteres de la ruta';
ALTER TABLE dipole.expedition_PrintOut ADD CONSTRAINT expedition_PrintOut_FK_4 FOREIGN KEY (ticketFk) REFERENCES vn.ticket(id);
ALTER TABLE dipole.expedition_Read ADD CONSTRAINT expedition_Read_FK_1 FOREIGN KEY (expeditionFk) REFERENCES vn.expedition(id);
ALTER TABLE edi.bucket ADD CONSTRAINT bucket_FK FOREIGN KEY (bucket_type_id) REFERENCES edi.bucket_type(bucket_type_id) ON UPDATE CASCADE;
ALTER TABLE edi.clientFHAdminNumber ADD CONSTRAINT clientFHAdminNumber_FK_1 FOREIGN KEY (clientFk) REFERENCES vn.client(id) ON UPDATE CASCADE;
*/