-- Place your SQL code here
ALTER TABLE vn2008.Rutas_Master DROP FOREIGN KEY fk_rutas_warehouse_id;

ALTER TABLE `vn2008`.`Rutas_Master` RENAME `vn`.`routeMaster`;

ALTER TABLE `vn`.`routeMaster` 
CHANGE COLUMN `warehouse_id` `warehoseFk` SMALLINT(6) unsigned DEFAULT NULL,
CHANGE COLUMN `km` `km` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `bultos` `packages` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `vehiculos_coste` `vehicleCost` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `personal_coste` `staffCost` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `vehiculos_numero` `vehicle` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `personal_numero` `staff` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `gasoil` `fuel` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `autonomos` `freelancers` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `año` `year` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `mes` `mounth` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `gastos` `expense` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `bultos_autonomos` `freelancersPackages` INT(11) NOT NULL DEFAULT 0,
CHANGE COLUMN `coste_km` `kmCost` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `coste_bulto` `packageCost` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `coste_bulto_autonomo` `freelancerPackageCost` DECIMAL(10,2) NOT NULL DEFAULT 0.00,
CHANGE COLUMN `odbc_date` `created` TIMESTAMP NULL DEFAULT current_timestamp();

ALTER TABLE vn.routeMaster ADD CONSTRAINT routeMaster_FK FOREIGN KEY (warehoseFk) REFERENCES vn.warehouse(id);
