-- ======================
-- SCIM: Users
-- ======================
CREATE TABLE "unified_scim_user" (
  "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,
  "schemas"                VARIANT,
  "externalId"             VARCHAR,
  "userType"               VARCHAR,
  "userName"               VARCHAR,
  "meta"                   VARIANT,
  "name"                   VARIANT,
  "displayName"            VARCHAR,
  "nickName"               VARCHAR,
  "profileUrl"             VARCHAR,
  "title"                  VARCHAR,
  "preferredLanguage"      VARCHAR,
  "locale"                 VARCHAR,
  "timezone"               VARCHAR,
  "active"                 BOOLEAN,
  "password"               VARCHAR,
  "phoneNumbers"           VARIANT,
  "emails"                 VARIANT,
  "ims"                    VARIANT,
  "photos"                 VARIANT,
  "addresses"              VARIANT,
  "groups"                 VARIANT,
  "entitlements"           VARIANT,
  "roles"                  VARIANT,
  "x509Certificates"       VARIANT,
  "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" VARIANT,
  "urn:ietf:params:scim:schemas:extension:lattice:attributes:1.0:User" VARIANT,
  "urn:ietf:params:scim:schemas:extension:peakon:2.0:User" VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
-- ======================
-- SCIM: Groups
-- ======================
CREATE TABLE "unified_scim_group" (
  "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,
  "externalId"             VARCHAR,
  "displayName"            VARCHAR,
  "groupType"              VARCHAR,
  "members"                VARIANT,
  "meta"                   VARIANT,
  "schemas"                VARIANT,
  UNIQUE ("unified_connection_id", "unified_id")
);
