-- liquibase formatted sql
-- changeset cyril:update_suggested_pick_lot

ALTER TABLE `suggested_pick_lot`
    DROP FOREIGN KEY `FK_SUGGESTED_PICK_LOT_ON_SUGGESTEDLOTLINEID`;
ALTER TABLE `suggested_pick_lot`
    ADD COLUMN `pickOrderLineId` INT NULL AFTER `suggestedLotLineId`,
    ADD COLUMN `qty` DECIMAL(14,2) NULL AFTER `pickOrderLineId`,
    ADD COLUMN `pickSuggested` TINYINT(1) NULL AFTER `qty`,
    CHANGE COLUMN `suggestedLotLineId` `suggestedLotLineId` INT NULL ,
    ADD INDEX `FK_SUGGESTED_PICK_LOT_ON_PICKORDERLINEID` (`pickOrderLineId` ASC) VISIBLE;
;
ALTER TABLE `suggested_pick_lot`
    ADD CONSTRAINT `FK_SUGGESTED_PICK_LOT_ON_SUGGESTEDLOTLINEID`
        FOREIGN KEY (`suggestedLotLineId`)
            REFERENCES `inventory_lot_line` (`id`),
    ADD CONSTRAINT `FK_SUGGESTED_PICK_LOT_ON_PICKORDERLINEID`
        FOREIGN KEY (`pickOrderLineId`)
            REFERENCES `pick_order_line` (`id`)
            ON DELETE RESTRICT
            ON UPDATE RESTRICT;
