-- ======================
-- PERFORMANCE: Cycle
-- ======================
CREATE TABLE "unified_performance_cycle" (
  "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,
  "type"                   VARCHAR,
  "status"                 VARCHAR,
  "start_at"               TIMESTAMP_NTZ,
  "end_at"                 TIMESTAMP_NTZ,
  "due_at"                 TIMESTAMP_NTZ,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- PERFORMANCE: Review
-- ======================
CREATE TABLE "unified_performance_review" (
  "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,
  "user_id"                VARCHAR,
  "reviewer_user_id"       VARCHAR,
  "cycle_id"               VARCHAR,
  "template_identifier"    VARCHAR,
  "type"                   VARCHAR,
  "status"                 VARCHAR,
  "rating"                 FLOAT,
  "rating_maximum"         FLOAT,
  "rating_description"     VARCHAR,
  "comment"                VARCHAR,
  "questions"              VARIANT,
  "is_acknowledged"        BOOLEAN,
  "submitted_at"           TIMESTAMP_NTZ,
  "completed_at"           TIMESTAMP_NTZ,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- PERFORMANCE: Goal
-- ======================
CREATE TABLE "unified_performance_goal" (
  "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,
  "user_ids"               VARIANT,
  "company_id"             VARCHAR,
  "parent_id"              VARCHAR,
  "cycle_id"               VARCHAR,
  "type"                   VARCHAR,
  "status"                 VARCHAR,
  "progress"               FLOAT,
  "weight"                 FLOAT,
  "start_at"               TIMESTAMP_NTZ,
  "due_at"                 TIMESTAMP_NTZ,
  "completed_at"           TIMESTAMP_NTZ,
  "milestones"             VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- PERFORMANCE: Feedback
-- ======================
CREATE TABLE "unified_performance_feedback" (
  "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,
  "user_id"                VARCHAR,
  "author_user_id"         VARCHAR,
  "type"                   VARCHAR,
  "message"                VARCHAR,
  "tags"                   VARIANT,
  "is_visible"             BOOLEAN,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
