-- ======================
-- TASK: Project
-- ======================
CREATE TABLE "unified_task_project" (
  "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,
  "parent_id"              VARCHAR,
  "user_ids"               VARIANT,
  "group_ids"              VARIANT,
  "description"            VARCHAR,
  "has_tasks"              BOOLEAN,
  "has_children"           BOOLEAN,
  "metadata"               VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- TASK: Task
-- ======================
CREATE TABLE "unified_task_task" (
  "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,
  "project_id"             VARCHAR,
  "parent_id"              VARCHAR,
  "completed_at"           TIMESTAMP_NTZ,
  "status"                 VARCHAR,
  "notes"                  VARCHAR,
  "due_at"                 TIMESTAMP_NTZ,
  "start_at"               TIMESTAMP_NTZ,
  "end_at"                 TIMESTAMP_NTZ,
  "priority"               VARCHAR,
  "assigned_user_ids"      VARIANT,
  "creator_user_id"        VARCHAR,
  "follower_user_ids"      VARIANT,
  "group_ids"              VARIANT,
  "tags"                   VARIANT,
  "url"                    VARCHAR,
  "attachment_ids"         VARIANT,
  "metadata"               VARIANT,
  "has_children"           BOOLEAN,
  "type"                   VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- TASK: Comment
-- ======================
CREATE TABLE "unified_task_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,
  "text"                   VARCHAR,
  "user_id"                VARCHAR,
  "user_name"              VARCHAR,
  "task_id"                VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- TASK: Change
-- ======================
CREATE TABLE "unified_task_change" (
  "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,
  "task_id"                VARCHAR,
  "user_id"                VARCHAR,
  "items"                  VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
