ALTER TABLE hedera.`orderConfig` ADD CONSTRAINT `orderConfigCompany_Fk` FOREIGN KEY IF NOT EXISTS (defaultCompanyFk) REFERENCES vn.company(id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`project` ADD CONSTRAINT `projectCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.`vehicle` ADD CONSTRAINT `vehicleCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`routeConfig` ADD CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY IF NOT EXISTS (defaultCompanyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE vn.`entry` ADD CONSTRAINT `entryCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`payment` ADD CONSTRAINT `paymentCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`receipt` ADD CONSTRAINT `receiptCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`invoiceIn` ADD CONSTRAINT `invoiceInCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`sinister` ADD CONSTRAINT `sinisterCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.`supplierExpense` ADD CONSTRAINT `supplierExpenseCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`ticket` ADD CONSTRAINT `ticketCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`mandate` ADD CONSTRAINT `mandateCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE NO ACTION ON UPDATE CASCADE;
ALTER TABLE vn.`XDiario` ADD CONSTRAINT `XDiarioCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.`dms` ADD CONSTRAINT `dmsCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`property` ADD CONSTRAINT `propertyCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`cmr` ADD CONSTRAINT `cmrCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE SET NULL ON UPDATE CASCADE;
ALTER TABLE vn.`host` ADD CONSTRAINT `hostCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`clientRisk` ADD CONSTRAINT `clientRiskCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.`ppe` ADD CONSTRAINT `ppeCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
-- ALTER TABLE vn.`invoiceOut` ADD CONSTRAINT `invoiceOutCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`dua` ADD CONSTRAINT `duaCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn.`clientSample` ADD CONSTRAINT `clientSampleCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`Saldos_Prevision` ADD CONSTRAINT `Saldos_PrevisionCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`pago_sdc` ADD CONSTRAINT `pago_sdcCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`Clientes_empresa` ADD CONSTRAINT `Clientes_empresaCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE NO ACTION ON UPDATE RESTRICT;
ALTER TABLE vn2008.`Bancos_poliza` ADD CONSTRAINT `Bancos_polizaCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`albaran` ADD CONSTRAINT `albaranCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`Remesas` ADD CONSTRAINT `RemesasCompany_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE vn2008.`Enlaces Facturas__` ADD CONSTRAINT `EnlacesFacturas__Company_Fk` FOREIGN KEY IF NOT EXISTS (empresa_id) REFERENCES vn.company (id) ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE bs.`sale` ADD CONSTRAINT `saleCompany_Fk` FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company (id) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE vn.`farming` ADD CONSTRAINT `farmingCompany_Fk` FOREIGN KEY IF NOT EXISTS(companyFk) REFERENCES vn.company(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
ALTER TABLE vn.`companyI18n` ADD CONSTRAINT `companyI18nCompany_Fk` FOREIGN KEY IF NOT EXISTS(companyFk) REFERENCES vn.company(id) ON DELETE RESTRICT ON UPDATE CASCADE;
