-- liquibase formatted sql
-- changeset enson:altertable_enson

SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `fpsmsdb`.`warehouse`;


CREATE TABLE `warehouse`
(
    `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',
    `code`            VARCHAR(30)    NOT NULL,
    `name`            VARCHAR(30)    NOT NULL,
    `description`     VARCHAR(30)    NOT NULL,
    `capacity`        DECIMAL(14, 2) NOT NULL,
    `warehouse`       VARCHAR(30)    NULL DEFAULT NULL,
    `area`            VARCHAR(30)    NULL DEFAULT NULL,
    `slot`            VARCHAR(30)    NULL DEFAULT NULL,
    `order`           INT            NULL DEFAULT NULL,
    `store_id`        VARCHAR(50)    NULL DEFAULT NULL,
    `storeLocation`   VARCHAR(255)   NULL DEFAULT NULL,
    `stockTakeTable`  VARCHAR(255)   NULL DEFAULT NULL,
    `company`         VARCHAR(255)   NULL DEFAULT NULL,
    CONSTRAINT pk_warehouse PRIMARY KEY (id)
);

SET FOREIGN_KEY_CHECKS = 1;


ALTER TABLE `fpsmsdb`.`items` 
add column `storeLocation` VARCHAR(255) After `store_id`,
add column `warehouse` VARCHAR(255) After `storeLocation`,
add column `area` VARCHAR(255) After `warehouse`,
add column `slot` VARCHAR(255) After `area`,
add column `LocationCode` VARCHAR(255) After `MTMSPickRoutingID`,
add column `Uom` VARCHAR(255) After `uomId`;
