--- iqchat-channels


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

  created_at  TIMESTAMPTZ NOT NULL,
  updated_at  TIMESTAMPTZ NOT NULL,
  deleted_at  TIMESTAMPTZ,
  restored_at TIMESTAMPTZ
);

-- iqchat-apns

CREATE TABLE iqchat_apns (
  channel_id  BIGINT       NOT NULL REFERENCES iqchat_channels (channel_id),

  enabled     BOOLEAN      NOT NULL,
  certificate TEXT         NOT NULL,
  "key"       TEXT         NOT NULL,
  password    VARCHAR(255) NOT NULL,
  topic       VARCHAR(255) NOT NULL,
  production  BOOLEAN      NOT NULL,

  created_at  TIMESTAMP    NOT NULL,
  updated_at  TIMESTAMP    NOT NULL
);
