USE vn;

ALTER TABLE `vn`.`printer` 
ADD COLUMN `sectorFk` INT(11) NULL DEFAULT NULL AFTER `isLabeler`,
ADD INDEX `printer_sectorFk_idx` (`id` ASC, `sectorFk` ASC) ;

ALTER TABLE `vn`.`printer` 
ADD CONSTRAINT `printer_sectorFk`
  FOREIGN KEY (`sectorFk`)
  REFERENCES `vn`.`sector` (`id`)
  ON DELETE RESTRICT
  ON UPDATE CASCADE;


DELETE FROM `vn`.`sector` WHERE (`id` = '61') and (`warehouseFk` = '60');
UPDATE `vn`.`sector` SET `description` = 'Zona Palletizado', `code` = 'pallet1' WHERE (`id` = '60') and (`warehouseFk` = '60');

UPDATE `vn`.`printer` SET `sectorFk` = '60' WHERE (`id` = '68');
UPDATE `vn`.`printer` SET `sectorFk` = '60' WHERE (`id` = '54');
UPDATE `vn`.`printer` SET `sectorFk` = '60' WHERE (`id` = '58');
UPDATE `vn`.`printer` SET `sectorFk` = '60' WHERE (`id` = '60');
UPDATE `vn`.`printer` SET `sectorFk` = '40' WHERE (`id` = '89');
UPDATE `vn`.`printer` SET `sectorFk` = '40' WHERE (`id` = '66');
UPDATE `vn`.`printer` SET `sectorFk` = '41' WHERE (`id` = '88');
UPDATE `vn`.`printer` SET `sectorFk` = '41' WHERE (`id` = '36');
