mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
Add a source filter to both management lists. Mood gains an optional `source` param (validated against the mood source set); measurements gain `sourceEq` (validated against MeasurementSource) — the `source` key on the measurements list is the rollup-tier opt-in, so the filter rides a distinct param. Both thread into the list `where` alongside the pinned `userId` + `deletedAt: null`. Migration 0136 adds two additive indexes — `(userId, source, measuredAt)` on measurements and `(userId, source, moodLoggedAt)` on mood — so a source filter + recency sort is an index range scan rather than a userId scan plus in-memory sort at 100-200k rows per user. Pure `CREATE INDEX IF NOT EXISTS`, no backfill. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>