-- liquibase formatted sql
-- changeset cyril:create pick order

CREATE TABLE `pick_order_group`
(
    `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',
    `pick_order_id` INT ,  
    `name` VARCHAR(50) NOT NULL UNIQUE,  
    `target_date` DATE NOT NULL,
    `releasedBy`   INT          NULL,
    CONSTRAINT pk_pick_order_group PRIMARY KEY (id),
    CONSTRAINT `FK_PICK_ORDER_GROUP_ON_PICK_ORDER_ID` FOREIGN KEY (`pick_order_id`) REFERENCES `pick_order` (`id`),
    CONSTRAINT `FK_PICK_ORDER_GROUP_ON_RELEASEDBY` FOREIGN KEY (`releasedBy`) REFERENCES `user` (`id`)
);