salix/db/versions/10836-limeCordyline/09-link.sql

12 lines
622 B
SQL

ALTER TABLE IF EXISTS `vn2008`.`link` RENAME `vn`.`link`;
ALTER TABLE IF EXISTS `vn`.`link`
CHANGE COLUMN IF EXISTS `Id_Cliente` `clientFk` int(11) NOT NULL,
CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(11) NOT NULL;
ALTER TABLE IF EXISTS vn.link MODIFY COLUMN supplierFk int(10) unsigned NOT NULL;
ALTER TABLE IF EXISTS vn.link ADD CONSTRAINT link_client_FK FOREIGN KEY (clientFk) REFERENCES vn.client(id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE IF EXISTS vn.link ADD CONSTRAINT link_supplier_FK FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON DELETE CASCADE ON UPDATE CASCADE;