--liquibase formatted sql

--changeset cyril:create equipment table
CREATE TABLE `equipment_type`
(
    `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(500) NOT NULL,
    CONSTRAINT pk_equipment_type PRIMARY KEY (id)
);

CREATE TABLE `equipment`
(
    `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(500) NOT NULL,
    `equipmentTypeId` INT NULL,
    CONSTRAINT pk_equipment PRIMARY KEY (id),
    CONSTRAINT `FK_EQUIPMENT_ON_EQUIPMENTTYPEID` FOREIGN KEY (`equipmentTypeId`) REFERENCES `equipment_type` (`id`)
);