-- liquibase formatted sql
-- changeset cyril:update_qc

ALTER TABLE `qc_item_category`
    ADD COLUMN `description` VARCHAR(1000) NULL AFTER `qcCategoryId`;

ALTER TABLE `item_category`
    ADD COLUMN `code` VARCHAR(100) NULL AFTER `deleted`,
    ADD COLUMN `sub` VARCHAR(100) NULL AFTER `parent`,
    ADD COLUMN `temperature` VARCHAR(100) NULL AFTER `sub`,
    ADD COLUMN `qcCategoryId` INT NULL AFTER `temperature`,
    CHANGE COLUMN `name` `parent` VARCHAR(100) NULL ,
    ADD INDEX `FK_ITEM_CATEGORY_ON_QC_CATEGORY_ID` (`qcCategoryId` ASC) VISIBLE;
;
ALTER TABLE `item_category`
    ADD CONSTRAINT `FK_ITEM_CATEGORY_ON_QC_CATEGORY_ID`
        FOREIGN KEY (`qcCategoryId`)
            REFERENCES `qc_category` (`id`)
            ON DELETE RESTRICT
            ON UPDATE RESTRICT;
