-- ======================
-- PERFORMANCE: Cycle
-- ======================
CREATE TABLE unified_performance_cycle (
  unified_connection_id  text NOT NULL,
  unified_webhook_id     text NOT NULL,
  unified_external_xref  text,
  unified_integration_type text NOT NULL,
  unified_raw_id         text,
  unified_id             text NOT NULL,
  id                   text,
  created_at           timestamptz,
  updated_at           timestamptz,
  name                 text,
  description          text,
  type                 text,
  status               text,
  start_at             timestamptz,
  end_at               timestamptz,
  due_at               timestamptz,
  raw                  jsonb
);
-- ======================
-- PERFORMANCE: Review
-- ======================
CREATE TABLE unified_performance_review (
  unified_connection_id  text NOT NULL,
  unified_webhook_id     text NOT NULL,
  unified_external_xref  text,
  unified_integration_type text NOT NULL,
  unified_raw_id         text,
  unified_id             text NOT NULL,
  id                   text,
  created_at           timestamptz,
  updated_at           timestamptz,
  user_id              text,
  reviewer_user_id     text,
  cycle_id             text,
  template_identifier  text,
  type                 text,
  status               text,
  rating               numeric,
  rating_maximum       numeric,
  rating_description   text,
  comment              text,
  questions            jsonb,
  is_acknowledged      boolean,
  submitted_at         timestamptz,
  completed_at         timestamptz,
  raw                  jsonb
);
-- ======================
-- PERFORMANCE: Goal
-- ======================
CREATE TABLE unified_performance_goal (
  unified_connection_id  text NOT NULL,
  unified_webhook_id     text NOT NULL,
  unified_external_xref  text,
  unified_integration_type text NOT NULL,
  unified_raw_id         text,
  unified_id             text NOT NULL,
  id                   text,
  created_at           timestamptz,
  updated_at           timestamptz,
  name                 text,
  description          text,
  user_ids             text[],
  company_id           text,
  parent_id            text,
  cycle_id             text,
  type                 text,
  status               text,
  progress             numeric,
  weight               numeric,
  start_at             timestamptz,
  due_at               timestamptz,
  completed_at         timestamptz,
  milestones           jsonb,
  raw                  jsonb
);
-- ======================
-- PERFORMANCE: Feedback
-- ======================
CREATE TABLE unified_performance_feedback (
  unified_connection_id  text NOT NULL,
  unified_webhook_id     text NOT NULL,
  unified_external_xref  text,
  unified_integration_type text NOT NULL,
  unified_raw_id         text,
  unified_id             text NOT NULL,
  id                   text,
  created_at           timestamptz,
  updated_at           timestamptz,
  user_id              text,
  author_user_id       text,
  type                 text,
  message              text,
  tags                 text[],
  is_visible           boolean,
  raw                  jsonb
);
