Artifacts
Table for storing file artifacts associated with sessions and devices
| Column Name | Data Type | Constraints |
|---|---|---|
| id | bigint | NOT NULL |
| created_at | timestamp with time zone | DEFAULT now() NOT NULL |
| updated_at | timestamp with time zone | DEFAULT now() NOT NULL |
| file_path | text | NOT NULL |
| file_size_bytes | bigint | |
| session_id | bigint | |
| device_id | bigint | NOT NULL |
| modality | text | |
| timestamp_observation | timestamp with time zone | |
| timestamp_observation_end | timestamp with time zone | DEFAULT now() NOT NULL |
| embedded_at | timestamp with time zone | |
| segmented_at | timestamp with time zone | |
| tagged_at | timestamp with time zone | |
| tracked_at | timestamp with time zone | |
| thumbnail_file_path | text | |
| thumbnail_generated_at | timestamp with time zone | |
| proxy_file_path | text | |
| proxy_generated_at | timestamp with time zone | |
| processing_blocked_at | timestamp with time zone | |
| processing_blocked_reason | text | |
| uploaded_by | uuid | FK -> users; stamped from auth.uid() on insert by artifacts_uploaded_by, NULL for device and service uploads, immutable afterwards |
Security Policies (RLS)
RLS enabled. Herd scope: Herd from artifacts.device_id → get_herd_id_by_device_id.
| Operation | has_herd_ability ability key | Other paths |
|---|---|---|
| SELECT | media.read | Owning device API key; approved gateway in herd |
| INSERT | media.write | Owning device API key; approved gateway in herd |
| UPDATE | media.write | Owning device API key; approved gateway in herd |
| DELETE | media.write | Owning device API key; approved gateway in herd |
Platform superadmin: FOR ALL bypass where defined.