POST /api/v1/location/{arrive,leave} records place intervals (home or a
named place, and away in between) from Shortcuts automations. A stale
"leave" for a place the device has already left is ignored. The Health
Auto Export endpoint and its normalizer are removed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
9 lines
351 B
SQL
9 lines
351 B
SQL
-- +goose Up
|
|
-- A device has at most one open location interval: the place it is in now.
|
|
-- Open intervals are stored with ended_at = started_at and read as ending now.
|
|
CREATE UNIQUE INDEX activities_open_location_idx ON activities (device_id)
|
|
WHERE source = 'location' AND attrs ? 'open';
|
|
|
|
-- +goose Down
|
|
DROP INDEX activities_open_location_idx;
|