--liquibase formatted sql

--changeset cyril:create item_uom table
CREATE TABLE `item_uom`
(
    `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',
    `uomId`             INT      NOT NULL,
    `itemId`           INT      NOT NULL,
    `baseUnit`          TINYINT  NOT NULL DEFAULT '0',
    `stockUnit`         TINYINT  NOT NULL DEFAULT '0',
    `pickingUnit`       TINYINT  NOT NULL DEFAULT '0',
    `salesUnit`         TINYINT  NOT NULL DEFAULT '0',
    `purchaseUnit`      TINYINT  NOT NULL DEFAULT '0',
    `price`             DECIMAL(14, 2) NULL,
    `currencyId`        INT NULL,
    `m18Id`             INT      NOT NULL,
    `m18LastModifyDate` DATETIME NULL,
    CONSTRAINT pk_item_uom PRIMARY KEY (id),
    CONSTRAINT FK_ITEM_UOM_ON_UOMID FOREIGN KEY (uomId) REFERENCES uom_conversion (id),
    CONSTRAINT FK_ITEM_UOM_ON_ITEMID FOREIGN KEY (itemId) REFERENCES items (id),
    CONSTRAINT FK_ITEM_UOM_ON_CURRENCYID FOREIGN KEY (currencyId) REFERENCES currency (id)
);