salix/db/versions/.archive/10119-navyGerbera/00-AfegirFKPart1.sql

18 lines
1.6 KiB
SQL

/*ALTER TABLE bi.rutasBoard ADD CONSTRAINT rutasBoard_FK FOREIGN KEY (warehouse_id) REFERENCES vn.warehouse(id);
ALTER TABLE bi.tarifa_warehouse MODIFY COLUMN warehouse_id smallint(6) UNSIGNED NOT NULL;
ALTER TABLE bi.tarifa_warehouse ADD CONSTRAINT tarifa_warehouse_FK FOREIGN KEY (warehouse_id) REFERENCES vn.warehouse(id);
ALTER TABLE bi.XDiario_ALL MODIFY COLUMN empresa_id SMALLINT (5) UNSIGNED NOT NULL;
ALTER TABLE bi.XDiario_ALL ADD CONSTRAINT XDiario_ALL_FK FOREIGN KEY (empresa_id) REFERENCES vn.company(id);
ALTER TABLE bs.defaulter ADD CONSTRAINT defaulter_FK FOREIGN KEY (clientFk) REFERENCES vn.client(id);
ALTER TABLE bs.inspeccionSS_2021 ADD CONSTRAINT inspeccionSS_2021_FK FOREIGN KEY (business_id) REFERENCES postgresql.business(business_id);
DELETE FROM bs.m3 WHERE id=589880;
DELETE FROM bs.m3 WHERE id=639521;
DELETE FROM bs.m3 WHERE id=639984;
ALTER TABLE bs.m3 ADD CONSTRAINT m3_FK FOREIGN KEY (provinceFk) REFERENCES vn.province(id);
ALTER TABLE bs.m3 ADD CONSTRAINT m3Warehouse_FK FOREIGN KEY (warehouseFk) REFERENCES vn.warehouse(id) ON UPDATE CASCADE;
ALTER TABLE bs.ventas_contables MODIFY COLUMN empresa_id smallint(5) unsigned NOT NULL;
ALTER TABLE bs.ventas_contables ADD CONSTRAINT ventas_contables_FK FOREIGN KEY (empresa_id) REFERENCES vn.company(id);
DELETE FROM bs.ventas_contables WHERE tipo_id = 97; -- BORRE PER QUE ESTE TIPO JA NO EXISTEIX
ALTER TABLE cache.cache_calc ADD CONSTRAINT cache_calc_FK FOREIGN KEY (cache_id) REFERENCES cache.cache(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE cache.last_buy MODIFY COLUMN item_id int(11) NOT NULL;
comente per que ja s'ha executat esta part*/