-- ======================
-- KMS: Space
-- ======================
CREATE TABLE "unified_kms_space" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "name"                   VARCHAR,
  "description"            VARCHAR,
  "parent_id"              VARCHAR,
  "is_active"              BOOLEAN,
  "user_id"                VARCHAR,
  "parent_page_id"         VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- KMS: Page
-- ======================
CREATE TABLE "unified_kms_page" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "title"                  VARCHAR,
  "type"                   VARCHAR,
  "space_id"               VARCHAR,
  "parent_id"              VARCHAR,
  "is_active"              BOOLEAN,
  "user_id"                VARCHAR,
  "download_url"           VARCHAR,
  "metadata"               VARIANT,
  "has_children"           BOOLEAN,
  "web_url"                VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- KMS: Comment
-- ======================
CREATE TABLE "unified_kms_comment" (
  "unified_connection_id"  VARCHAR NOT NULL,
  "unified_webhook_id"     VARCHAR NOT NULL,
  "unified_external_xref"  VARCHAR,
  "unified_integration_type" VARCHAR NOT NULL,
  "unified_raw_id"         VARCHAR,
  "unified_id"             VARCHAR NOT NULL,
  "id"                     VARCHAR,
  "created_at"             TIMESTAMP_NTZ,
  "updated_at"             TIMESTAMP_NTZ,
  "type"                   VARCHAR,
  "content_type"           VARCHAR,
  "content"                VARCHAR,
  "user_id"                VARCHAR,
  "page_id"                VARCHAR,
  "parent_id"              VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
