--- autoreplies


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

  [type]           VARCHAR(32)    NOT NULL,
  user_id          BIGINT REFERENCES users (id),
  text             NVARCHAR(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       DATETIMEOFFSET NOT NULL DEFAULT sysdatetimeoffset(),
  updated_at       DATETIMEOFFSET NOT NULL DEFAULT sysdatetimeoffset()
);

CREATE INDEX autoreplies_channel_id_ix
  ON autoreplies (channel_id);
