ALTER TABLE IF EXISTS `vn2008`.`albaran` RENAME `vn`.`deliveryNote`;

ALTER TABLE IF EXISTS `vn`.`deliveryNote`
CHANGE COLUMN IF EXISTS `albaran_id` `id` int(11) NOT NULL AUTO_INCREMENT,
CHANGE COLUMN IF EXISTS `fecha` `shipped` date NOT NULL,
CHANGE COLUMN IF EXISTS `fecha_entrega` `landed` date DEFAULT NULL,
CHANGE COLUMN IF EXISTS `valor` `amount` double DEFAULT NULL,
CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL,
CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL,
CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(6) unsigned NOT NULL,
CHANGE COLUMN IF EXISTS `albaran_state_id` `stateFk` int(11) NOT NULL,
CHANGE COLUMN IF EXISTS `Id_Trabajador` `workerFk` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán',
CHANGE COLUMN IF EXISTS `Id_Responsable` `supervisorFk` int(10) unsigned NOT NULL,
CHANGE COLUMN IF EXISTS `department_id` `departmentFk` int(11) NOT NULL,
CHANGE COLUMN IF EXISTS `recibida_id` `invoiceInFk` mediumint(8) unsigned DEFAULT NULL;