-- 010-autoreplies

CREATE TABLE autoreplies (
  id                  NUMBER(19) PRIMARY KEY,
  project_id          NUMBER(19)               NOT NULL REFERENCES projects (id),
  enabled             NUMBER(1)                NOT NULL,
  deleted             NUMBER(1)                NOT NULL,
  type                VARCHAR2(32 CHAR)        NOT NULL,
  text                VARCHAR2(1024 CHAR)      NOT NULL,

  offline_user_id     NUMBER(19) REFERENCES users (id),
  offline_days        VARCHAR2(255 CHAR),
  offline_start_hour  NUMBER(10)               NOT NULL,
  offline_end_hour    NUMBER(10)               NOT NULL,
  offline_timeout_min NUMBER(10)               NOT NULL,

  created_at          TIMESTAMP WITH TIME ZONE NOT NULL,
  updated_at          TIMESTAMP WITH TIME ZONE NOT NULL,
  deleted_at          TIMESTAMP WITH TIME ZONE
);

CREATE SEQUENCE autoreplies_id_seq;

CREATE INDEX autoreplies_project_id_ix
  ON autoreplies (project_id);
