Files
ccp/internal/migrations/00002_location.sql
T
adamfandClaude Opus 5.5 67638cdef0 Replace Apple Health ingest with iPhone location geofences
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]>
2026-10-14 22:06:25 +01:00

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;