--liquibase formatted sql

--changeset derek:re create qc result
DROP TABLE `qc_result`;
CREATE TABLE `qc_result`
(
    `id` INT NOT NULL AUTO_INCREMENT,
    `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `createdBy` VARCHAR(30) NULL DEFAULT NULL,
    `version` INT NOT NULL DEFAULT '0',
    `modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `modifiedBy` VARCHAR(30) NULL DEFAULT NULL,
    `deleted` TINYINT(1) NOT NULL DEFAULT '0',
    `qcItemId` INT NOT NULL,
    `itemId` INT NOT NULL,
    `stockInLineId` INT NULL,
    `stockOutLineId` INT NULL,
    `failQty` DECIMAL(14, 2) NOT NULL,
    `type` VARCHAR(255) NOT NULL,
    `remarks` VARCHAR(255) NOT NULL,
    CONSTRAINT PK_QC_RESULT PRIMARY KEY (id),
    CONSTRAINT FK_QC_RESULT_TO_QC_ITEM_ON_QC_ITEM_ID FOREIGN KEY (`qcItemId`) REFERENCES `qc_item` (`id`),
    CONSTRAINT FK_QC_RESULT_TO_ITEMS_ON_ITEM_ID FOREIGN KEY (`itemId`) REFERENCES `items` (`id`),
    CONSTRAINT FK_QC_RESULT_TO_STOCK_IN_LINE_ON_STOCK_IN_LINE_ID FOREIGN KEY (`stockInLineId`) REFERENCES `stock_in_line` (`id`),
    CONSTRAINT FK_QC_RESULT_TO_STOCK_OUT_LINE_ON_STOCK_OUT_LINE_ID FOREIGN KEY (`stockOutLineId`) REFERENCES `stock_out_line` (`id`)
);