--liquibase formatted sql

--changeset derek:master item table

CREATE TABLE items
(
    id                INT         NOT NULL AUTO_INCREMENT,
    version           INT         NOT NULL DEFAULT '0',
    created           datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    createdBy         VARCHAR(30) NULL,
    modified          datetime    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    modifiedBy        VARCHAR(30) NULL,
    deleted           TINYINT(1) NOT NULL DEFAULT '0',
    `code`            VARCHAR(50) NOT NULL,
    `name`            VARCHAR(500) NOT NULL,
    description       VARCHAR(500) NULL,
    remarks           varchar(500) NULL,
    type              VARCHAR(50) NOT NULL,
    uomId             INT(11) NOT NULL DEFAULT 0,
    shelfLife         INT(11) NULL,
    countryOfOrigin   varchar(50) NULL,
    maxQty            DECIMAL(16, 2) NULL,
    m18Id             INT(11) NULL,
    m18LastModifyDate datetime    NOT NULL,
    CONSTRAINT pk_material PRIMARY KEY (id)
);
CREATE TABLE uom_conversion
(
    id          INT            NOT NULL AUTO_INCREMENT,
    version     INT            NOT NULL DEFAULT '0',
    created     datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP,
    createdBy   VARCHAR(30) NULL,
    modified    datetime       NOT NULL DEFAULT CURRENT_TIMESTAMP,
    modifiedBy  VARCHAR(30) NULL,
    deleted     TINYINT(1) NOT NULL DEFAULT '0',
    numerator   DECIMAL(16, 2) NOT NULL DEFAULT 1,
    numUnit     VARCHAR(50)    NOT NULL,
    denominator DECIMAL(16, 2) NOT NULL DEFAULT 1,
    denUnit     VARCHAR(50)    NOT NULL,
    description VARCHAR(255)   NOT NULL,
    CONSTRAINT pk_uom_conversion PRIMARY KEY (id)
);