Files
HealthLog/prisma/migrations/0139_v11520_intake_attribution_source/migration.sql
T
Marc-André Bombeck 51dd614199 feat(coach,auth): self-context for the assistant, invite links, proactive nudges
Users can now tell the assistant about themselves in an encrypted
free-text profile that feeds the coach and briefing prompts as clearly
fenced context, with the coach allowed one targeted follow-up question
when the picture is incomplete. Operators on closed registrations can
mint expiring invite links with a QR code from the admin area; a valid
invite opens registration exactly as many times as it allows and records
who redeemed it. A nightly pass watches three deterministic signals —
low adherence, blood pressure above its target band, a falling recovery
trend — and sends at most one coach nudge per week through the existing
notification channels, gated behind the same opt-outs as every other
assistant surface.
2026-06-10 15:40:48 +02:00

17 lines
906 B
SQL

-- v1.15.20 — provenance of an intake row's slot binding.
--
-- An off-window take can now be deliberately pinned onto a scheduled slot
-- ("diesem Slot zuordnen"). The column records HOW the row's `scheduled_for`
-- binding came to be: AUTO = window-band attribution (or a skip / pending
-- mint anchored on its slot), USER_PIN = a deliberate user pin. The read
-- ledger binds USER_PIN rows by their stored anchor (like skips) instead of
-- re-running takenAt-band attribution, so a pinned take outside the late
-- tail stays on its slot — rendered taken-late, never on-time-washed.
--
-- Additive + non-destructive: a new NOT NULL column with a default, no
-- backfill needed. Existing rows read AUTO.
CREATE TYPE "intake_attribution_source" AS ENUM ('AUTO', 'USER_PIN');
ALTER TABLE "medication_intake_events"
ADD COLUMN "attribution_source" "intake_attribution_source" NOT NULL DEFAULT 'AUTO';