81 lines
8.4 KiB
SQL
81 lines
8.4 KiB
SQL
ALTER TABLE vn.`budget` DROP FOREIGN KEY IF EXISTS `budget_FK_3`;
|
|
ALTER TABLE vn.`supplierContact` DROP FOREIGN KEY IF EXISTS `supplier_id`;
|
|
ALTER TABLE vn.`entry` DROP FOREIGN KEY IF EXISTS `entry_ibfk_1`;
|
|
ALTER TABLE vn.`payment` DROP FOREIGN KEY IF EXISTS `pago_ibfk_3`;
|
|
ALTER TABLE vn.`travelClonedWeekly` DROP FOREIGN KEY IF EXISTS `travelClonedWeekly_FK_3`;
|
|
ALTER TABLE vn.`invoiceIn` DROP FOREIGN KEY IF EXISTS `invoiceIn_ibfk_1`;
|
|
ALTER TABLE vn.`sinister` DROP FOREIGN KEY IF EXISTS `sinister_fk1`;
|
|
ALTER TABLE vn.`comparativeFilter` DROP FOREIGN KEY IF EXISTS `comparativeFilter_FK_2`;
|
|
ALTER TABLE vn.`supplierExpense` DROP FOREIGN KEY IF EXISTS `proveedor_pago`;
|
|
ALTER TABLE vn.`supplierAccount` DROP FOREIGN KEY IF EXISTS `supplierAccount_FK`;
|
|
ALTER TABLE vn.`roadmap` DROP FOREIGN KEY IF EXISTS `roadmap_ibfk_1`;
|
|
ALTER TABLE vn.`awb` DROP FOREIGN KEY IF EXISTS `awbTransitoryFk`;
|
|
ALTER TABLE vn.`awb` DROP FOREIGN KEY IF EXISTS `awb_FK_2`;
|
|
ALTER TABLE vn.`supplierLog` DROP FOREIGN KEY IF EXISTS `supplierLog_ibfk_1`;
|
|
ALTER TABLE vn.`cmr` DROP FOREIGN KEY IF EXISTS `cm_fk4`;
|
|
ALTER TABLE vn.`duaTax` DROP FOREIGN KEY IF EXISTS `duaTax_fk2`;
|
|
ALTER TABLE vn.`supplierAgencyTerm` DROP FOREIGN KEY IF EXISTS `agencyTerm_FK_1`;
|
|
ALTER TABLE vn.`machine` DROP FOREIGN KEY IF EXISTS `machine_FK_2`;
|
|
ALTER TABLE vn2008.`travel_pattern` DROP FOREIGN KEY IF EXISTS `travel_pattern_ibfk_6`;
|
|
ALTER TABLE vn2008.`Bancos_poliza` DROP FOREIGN KEY IF EXISTS `bankNotaryIdx3`;
|
|
ALTER TABLE vn2008.`Bancos_poliza` DROP FOREIGN KEY IF EXISTS `bankSupplierIdx1`;
|
|
ALTER TABLE vn2008.`Vehiculos_consumo` DROP FOREIGN KEY IF EXISTS `proveedoresFk`;
|
|
ALTER TABLE vn2008.`albaran` DROP FOREIGN KEY IF EXISTS `fk_albaran_Proveedores`;
|
|
ALTER TABLE vn2008.`Proveedores_cargueras` DROP FOREIGN KEY IF EXISTS `proveedores_cargueras_fk1`;
|
|
ALTER TABLE vn2008.`Proveedores_comunicados` DROP FOREIGN KEY IF EXISTS `Proveedores_comunicados_ibfk_3`;
|
|
|
|
ALTER TABLE vn.supplier MODIFY COLUMN id INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`budget` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`supplierContact` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`entry` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT 644 NOT NULL ;
|
|
ALTER TABLE vn.`payment` MODIFY COLUMN supplierFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`travelClonedWeekly` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`invoiceIn` MODIFY COLUMN supplierFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`sinister` MODIFY COLUMN supplierFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`comparativeFilter` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`supplierExpense` MODIFY COLUMN supplierFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`supplierAccount` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`roadmap` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`awb` MODIFY COLUMN transitoryFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`awb` MODIFY COLUMN freightFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`supplierLog` MODIFY COLUMN originFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`cmr` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`duaTax` MODIFY COLUMN supplierFk INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn.`supplierAgencyTerm` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn.`machine` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn2008.`travel_pattern` MODIFY COLUMN cargoSupplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn2008.`Bancos_poliza` MODIFY COLUMN notaryFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn2008.`Bancos_poliza` MODIFY COLUMN supplierFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn2008.`Vehiculos_consumo` MODIFY COLUMN proveedoresFk INT UNSIGNED DEFAULT NULL;
|
|
ALTER TABLE vn2008.`albaran` MODIFY COLUMN Id_Proveedor INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn2008.`Proveedores_cargueras` MODIFY COLUMN Id_Proveedor INT UNSIGNED NOT NULL ;
|
|
ALTER TABLE vn2008.`Proveedores_comunicados` MODIFY COLUMN Id_Proveedor INT UNSIGNED NOT NULL ;
|
|
|
|
ALTER TABLE vn.`budget` ADD CONSTRAINT `budgetSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`supplierContact` ADD CONSTRAINT `supplierContactSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`entry` ADD CONSTRAINT `entrySupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`payment` ADD CONSTRAINT `paymentSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`travelClonedWeekly` ADD CONSTRAINT `travelClonedWeeklySupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`invoiceIn` ADD CONSTRAINT `invoiceInSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`sinister` ADD CONSTRAINT `sinisterSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`comparativeFilter` ADD CONSTRAINT `comparativeFilterSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
|
|
ALTER TABLE vn.`supplierExpense` ADD CONSTRAINT `supplierExpenseSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`supplierAccount` ADD CONSTRAINT `supplierAccountSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`roadmap` ADD CONSTRAINT `roadmapSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`awb` ADD CONSTRAINT `awbSupplier_Fk` FOREIGN KEY IF NOT EXISTS (transitoryFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`awb` ADD CONSTRAINT `awbSupplier_Fk` FOREIGN KEY IF NOT EXISTS (freightFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`supplierLog` ADD CONSTRAINT `supplierLogSupplier_Fk` FOREIGN KEY IF NOT EXISTS (originFk) REFERENCES vn.supplier (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`cmr` ADD CONSTRAINT `cmrSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`duaTax` ADD CONSTRAINT `duaTaxSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`supplierAgencyTerm` ADD CONSTRAINT `supplierAgencyTermSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn.`machine` ADD CONSTRAINT `machineSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`travel_pattern` ADD CONSTRAINT `travel_patternSupplier_Fk` FOREIGN KEY IF NOT EXISTS (cargoSupplierFk) REFERENCES vn.supplier (id) ON DELETE SET NULL ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`Bancos_poliza` ADD CONSTRAINT `Bancos_polizaSupplier_Fk` FOREIGN KEY IF NOT EXISTS (notaryFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`Bancos_poliza` ADD CONSTRAINT `Bancos_polizaSupplier_Fk` FOREIGN KEY IF NOT EXISTS (supplierFk) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`Vehiculos_consumo` ADD CONSTRAINT `Vehiculos_consumoSupplier_Fk` FOREIGN KEY IF NOT EXISTS (proveedoresFk) REFERENCES vn.supplier (id) ON DELETE NO ACTION ON UPDATE NO ACTION;
|
|
ALTER TABLE vn2008.`albaran` ADD CONSTRAINT `albaranSupplier_Fk` FOREIGN KEY IF NOT EXISTS (Id_Proveedor) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`Proveedores_cargueras` ADD CONSTRAINT `Proveedores_carguerasSupplier_Fk` FOREIGN KEY IF NOT EXISTS (Id_Proveedor) REFERENCES vn.supplier (id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
ALTER TABLE vn2008.`Proveedores_comunicados` ADD CONSTRAINT `Proveedores_comunicadosSupplier_Fk` FOREIGN KEY IF NOT EXISTS (Id_Proveedor) REFERENCES vn.supplier (id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
|
ALTER TABLE vn.company ADD CONSTRAINT company_FK FOREIGN KEY IF NOT EXISTS (id) REFERENCES vn.supplier(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|