CREATE TABLE TASK_DELETE_GUARD (
    TASK_NAME VARCHAR2(512) NOT NULL,
    GUARD_UUID VARCHAR2(36) NOT NULL,
    UPDATED_AT NUMBER(19) NOT NULL,
    PRIMARY KEY (TASK_NAME)
);

CREATE TABLE TASK_DELETE_BARRIER (
    TASK_NAME VARCHAR2(512) NOT NULL,
    GUARD_UUID VARCHAR2(36) NOT NULL,
    OWNER_NODE_ID VARCHAR2(512) NOT NULL,
    STATUS VARCHAR2(16) NOT NULL,
    DEADLINE_AT NUMBER(19) NOT NULL,
    UPDATED_AT NUMBER(19) NOT NULL,
    PRIMARY KEY (TASK_NAME, GUARD_UUID)
);

CREATE TABLE TASK_DELETE_BARRIER_EXPECTED (
    TASK_NAME VARCHAR2(512) NOT NULL,
    GUARD_UUID VARCHAR2(36) NOT NULL,
    NODE_ID VARCHAR2(220) NOT NULL,
    PRIMARY KEY (TASK_NAME, GUARD_UUID, NODE_ID)
);

CREATE TABLE TASK_DELETE_BARRIER_ACK (
    TASK_NAME VARCHAR2(512) NOT NULL,
    GUARD_UUID VARCHAR2(36) NOT NULL,
    NODE_ID VARCHAR2(220) NOT NULL,
    ACKED_AT NUMBER(19) NOT NULL,
    PRIMARY KEY (TASK_NAME, GUARD_UUID, NODE_ID)
);
