INSERT IGNORE INTO vn.entryType (code, description) VALUES ('devaluation', 'Devaluación'); ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueWarehouseOutFk SMALLINT(6) UNSIGNED NULL COMMENT 'Datos del travel para las entradas generadas al devaluar artículos de A1 a A2'; ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueAgencyModeFk INT(11) NULL; ALTER TABLE vn.travelConfig ADD IF NOT EXISTS devalueRef varchar(20) NULL; ALTER TABLE vn.travelConfig DROP FOREIGN KEY IF EXISTS travelConfig_agencyMode_FK; ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_agencyMode_FK FOREIGN KEY (devalueAgencyModeFk) REFERENCES vn.agencyMode(id) ON DELETE SET NULL ON UPDATE CASCADE; ALTER TABLE vn.travelConfig DROP FOREIGN KEY IF EXISTS travelConfig_warehouse_FK; ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_warehouse_FK FOREIGN KEY (devalueWarehouseOutFk) REFERENCES vn.warehouse(id) ON DELETE SET NULL ON UPDATE CASCADE;