ur_ingest_session

Column Type PK Required Default
ur_ingest_session_id VARCHAR Yes Yes
device_id VARCHAR No Yes
behavior_id VARCHAR No No
behavior_json TEXT No No
ingest_started_at TIMESTAMPTZ No Yes
ingest_finished_at TIMESTAMPTZ No No
session_agent TEXT No Yes
elaboration TEXT No No
created_at TIMESTAMPTZ No No CURRENT_TIMESTAMP
created_by TEXT No No 'UNKNOWN'
updated_at TIMESTAMPTZ No No
updated_by TEXT No No
deleted_at TIMESTAMPTZ No No
deleted_by TEXT No No
activity_log TEXT No No

Foreign Keys

Column Name Foreign Key
behavior_id behavior_id references behavior.behavior_id
device_id device_id references device.device_id

Indexes

Column Name Index Name
device_id sqlite_autoindex_ur_ingest_session_2
created_at sqlite_autoindex_ur_ingest_session_2
ur_ingest_session_id sqlite_autoindex_ur_ingest_session_1

SQL DDL

CREATE TABLE "ur_ingest_session" (
    "ur_ingest_session_id" VARCHAR PRIMARY KEY NOT NULL,
    "device_id" VARCHAR NOT NULL,
    "behavior_id" VARCHAR,
    "behavior_json" TEXT CHECK(json_valid(behavior_json) OR behavior_json IS NULL),
    "ingest_started_at" TIMESTAMPTZ NOT NULL,
    "ingest_finished_at" TIMESTAMPTZ,
    "session_agent" TEXT CHECK(json_valid(session_agent)) NOT NULL,
    "elaboration" TEXT CHECK(json_valid(elaboration) OR elaboration IS NULL),
    "created_at" TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
    "created_by" TEXT DEFAULT 'UNKNOWN',
    "updated_at" TIMESTAMPTZ,
    "updated_by" TEXT,
    "deleted_at" TIMESTAMPTZ,
    "deleted_by" TEXT,
    "activity_log" TEXT,
    FOREIGN KEY("device_id") REFERENCES "device"("device_id"),
    FOREIGN KEY("behavior_id") REFERENCES "behavior"("behavior_id"),
    UNIQUE("device_id", "created_at")
)