--liquibase formatted sql

--changeset cyril:create process table

CREATE TABLE `process`
(
    `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(1000) NULL,
    `remarks`     VARCHAR(1000) NULL,
    CONSTRAINT pk_process PRIMARY KEY (id)
);

CREATE TABLE `process_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',
    `equipmentId` INT      NOT NULL,
    `processId`   INT      NOT NULL,
    CONSTRAINT pk_process_equipment PRIMARY KEY (id),
    CONSTRAINT `FK_PROCESS_EQUIPMENT_ON_EQUIPMENTID` FOREIGN KEY (`equipmentId`) REFERENCES `equipment` (`id`),
    CONSTRAINT `FK_PROCESS_EQUIPMENT_ON_PROCESSID` FOREIGN KEY (`processId`) REFERENCES `process` (`id`)
);