-- liquibase formatted sql
-- changeset cyril:supervision approval log

CREATE TABLE `supervision_approval_log`
(
    `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',
    `personInCharge` INT NOT NULL,
    `type`           VARCHAR(100) NOT NULL,
    `stockInLineId`  INT          NULL,
    `stockOutLineId` INT          NULL,
    `recordDate`     DATETIME     NULL,
    `status`         VARCHAR(100) NOT NULL,
    `reason`         VARCHAR(500) NOT NULL,
    CONSTRAINT pk_supervision_approval_log PRIMARY KEY (id),
    CONSTRAINT `FK_SUPERVISION_APPROVAL_LOG_ON_PERSONINCHARGE` FOREIGN KEY (`personInCharge`) REFERENCES `user` (`id`),
    CONSTRAINT `FK_SUPERVISION_APPROVAL_LOG_ON_STOCKINLINEID` FOREIGN KEY (`stockInLineId`) REFERENCES `stock_in_line` (`id`),
    CONSTRAINT `FK_SUPERVISION_APPROVAL_LOG_ON_STOCKOUTLINEID` FOREIGN KEY (`stockOutLineId`) REFERENCES `stock_out_line` (`id`)
);