CREATE TABLE IF NOT EXISTS TASK_DELETE_GUARD (
  TASK_NAME VARCHAR (512) NOT NULL,
  GUARD_UUID VARCHAR (36) NOT NULL,
  UPDATED_AT BIGINT NOT NULL,
  PRIMARY KEY (TASK_NAME)
)ENGINE INNODB;

CREATE TABLE IF NOT EXISTS TASK_DELETE_BARRIER (
  TASK_NAME VARCHAR (512) NOT NULL,
  GUARD_UUID VARCHAR (36) NOT NULL,
  OWNER_NODE_ID VARCHAR (512) NOT NULL,
  STATUS VARCHAR (16) NOT NULL,
  DEADLINE_AT BIGINT NOT NULL,
  UPDATED_AT BIGINT NOT NULL,
  PRIMARY KEY (TASK_NAME, GUARD_UUID)
)ENGINE INNODB;

CREATE TABLE IF NOT EXISTS TASK_DELETE_BARRIER_EXPECTED (
  TASK_NAME VARCHAR (512) NOT NULL,
  GUARD_UUID VARCHAR (36) NOT NULL,
  NODE_ID VARCHAR (220) NOT NULL,
  PRIMARY KEY (TASK_NAME, GUARD_UUID, NODE_ID)
)ENGINE INNODB;

CREATE TABLE IF NOT EXISTS TASK_DELETE_BARRIER_ACK (
  TASK_NAME VARCHAR (512) NOT NULL,
  GUARD_UUID VARCHAR (36) NOT NULL,
  NODE_ID VARCHAR (220) NOT NULL,
  ACKED_AT BIGINT NOT NULL,
  PRIMARY KEY (TASK_NAME, GUARD_UUID, NODE_ID)
)ENGINE INNODB;
