Sessions
Table for recording time bound slices of data
| Column Name | Data Type | Constraints |
|---|---|---|
| id | bigint | NOT NULL |
| device_id | bigint | NOT NULL |
| base_device_id | bigint | |
| base_device_software_version | text | |
| battery_id | bigint | |
| secondary_battery_id | bigint | |
| post_approver | uuid | |
| timestamp_start | timestamp with time zone | NOT NULL |
| timestamp_end | timestamp with time zone | |
| inserted_at | timestamp with time zone | DEFAULT "now"() NOT NULL |
| software_version | text | NOT NULL |
| locations | extensions.geography | |
| altitude_max | double precision | NOT NULL |
| altitude_min | double precision | NOT NULL |
| altitude_average | double precision | NOT NULL |
| velocity_max | double precision | NOT NULL |
| velocity_min | double precision | NOT NULL |
| velocity_average | double precision | NOT NULL |
| distance_total | double precision | NOT NULL |
| distance_max_from_start | double precision | NOT NULL |
Security Policies (RLS)
RLS enabled. Herd scope: Herd from sessions.device_id → get_herd_id_by_device_id.
| Operation | has_herd_ability ability key | Other paths |
|---|---|---|
| SELECT | sessions.read | Owning device API key |
| INSERT | sessions.write | Owning device API key; approved gateway in herd |
| UPDATE | sessions.write | Owning device API key; approved gateway in herd |
| DELETE | sessions.write | Owning device API key |
Platform superadmin: FOR ALL bypass where defined.