-- ======================
-- SOCIAL: Post
-- ======================
CREATE TABLE "unified_social_post" (
  "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,
  "profile_id"             VARCHAR,
  "parent_post_id"         VARCHAR,
  "title"                  VARCHAR,
  "body"                   VARCHAR,
  "status"                 VARCHAR,
  "type"                   VARCHAR,
  "media"                  VARIANT,
  "url"                    VARCHAR,
  "language"               VARCHAR,
  "scheduled_at"           TIMESTAMP_NTZ,
  "call_to_action"         VARIANT,
  "metrics"                VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SOCIAL: Profile
-- ======================
CREATE TABLE "unified_social_profile" (
  "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,
  "username"               VARCHAR,
  "parent_id"              VARCHAR,
  "description"            VARCHAR,
  "url"                    VARCHAR,
  "website_url"            VARCHAR,
  "avatar_url"             VARCHAR,
  "phone"                  VARCHAR,
  "location"               VARCHAR,
  "address"                VARIANT,
  "category"               VARCHAR,
  "is_verified"            BOOLEAN,
  "is_private"             BOOLEAN,
  "metrics"                VARIANT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SOCIAL: Review
-- ======================
CREATE TABLE "unified_social_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,
  "profile_id"             VARCHAR,
  "rating"                 FLOAT,
  "title"                  VARCHAR,
  "content"                VARCHAR,
  "author_name"            VARCHAR,
  "author_avatar_url"      VARCHAR,
  "author_location"        VARCHAR,
  "reply"                  VARIANT,
  "url"                    VARCHAR,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SOCIAL: Insight
-- ======================
CREATE TABLE "unified_social_insight" (
  "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,
  "profile_id"             VARCHAR,
  "post_id"                VARCHAR,
  "date"                   TIMESTAMP_NTZ,
  "period"                 VARCHAR,
  "metric"                 VARCHAR,
  "value"                  FLOAT,
  "raw"                    VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
