--- iqchat-channels


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

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

-- iqchat-apns

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

  enabled     BIT            NOT NULL,
  certificate NTEXT          NOT NULL,
  [key]       NTEXT          NOT NULL,
  password    NVARCHAR(255)  NOT NULL,
  topic       NVARCHAR(255)  NOT NULL,
  production  BIT            NOT NULL,

  created_at  DATETIMEOFFSET NOT NULL,
  updated_at  DATETIMEOFFSET NOT NULL
);
