-- 016-iqchat

CREATE TABLE iqchat_channels (
  channel_id  NUMBER(19) PRIMARY KEY REFERENCES channels (id),
  deleted     NUMBER(1)                NOT NULL,
  created_at  TIMESTAMP WITH TIME ZONE NOT NULL,
  updated_at  TIMESTAMP WITH TIME ZONE NOT NULL,
  deleted_at  TIMESTAMP WITH TIME ZONE,
  restored_at TIMESTAMP WITH TIME ZONE
);

-- iqchat-apns

CREATE TABLE iqchat_apns (
  channel_id  NUMBER(19) PRIMARY KEY REFERENCES channels (id),
  enabled     NUMBER(1)                NOT NULL,
  certificate CLOB,
  key         CLOB,
  password    VARCHAR2(255 CHAR),
  topic       VARCHAR2(255 CHAR),
  production  NUMBER(1)                NOT NULL,

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