--- autoreplies


CREATE TABLE autoreplies (
  id               BIGINT PRIMARY KEY,
  channel_id       BIGINT        NOT NULL REFERENCES channels (id),
  enabled          BOOLEAN       NOT NULL,
  deleted          BOOLEAN       NOT NULL,

  type             VARCHAR(32)   NOT NULL,
  user_id          BIGINT REFERENCES users (id),
  text             VARCHAR(1024) NOT NULL,

  days             VARCHAR(255)  NOT NULL,
  start_hour       INTEGER       NOT NULL,
  end_hour         INTEGER       NOT NULL,
  no_operators_min INTEGER       NOT NULL,

  created_at       TIMESTAMPTZ   NOT NULL DEFAULT now(),
  updated_at       TIMESTAMPTZ   NOT NULL DEFAULT now()
);

CREATE SEQUENCE autoreplies_id_seq;

CREATE INDEX autoreplies_channel_id_ix
  ON autoreplies (channel_id);
