feat(schema): User.doctorReportPrefsJson + migration 0045

This commit is contained in:
Marc-André Bombeck committed 2026-05-14 13:19:17 +02:00
1 parent 58bbb4ec78
commit 7c06b89717
4 files changed
+234

No files matched your search

@@ -0,0 +1,24 @@
-- v1.4.25 W6c — per-user Doctor-Report section toggles.
--
-- The doctor-report dialog used to print every available data type
-- whether the user wanted it or not. Marc's directive 2026-05-14: users
-- decide which sections appear in their PDF, and the choice persists so
-- a follow-up export starts from the same picks.
--
-- Shape:
-- { "bp": boolean,
-- "weight": boolean,
-- "pulse": boolean,
-- "bmi": boolean,
-- "mood": boolean, -- privacy-sensitive; default OFF
-- "compliance": boolean,
-- "sleep": boolean }
--
-- Null = "use defaults": every section ON except mood. The privacy
-- default for mood is intentional — mental-health data should be opt-in,
-- not opt-out, even within a single user's own surface.
--
-- Forward-only, additive, idempotent. No backfill: a NULL row maps to
-- the documented defaults at read time.
ALTER TABLE "users"
ADD COLUMN IF NOT EXISTS "doctor_report_prefs_json" JSONB;
+14
View File
@@ -127,6 +127,20 @@ model User {
// model would still see the data the user excluded.
coachPrefsJson Json? @map("coach_prefs_json")
// v1.4.25 W6c — Doctor-report section toggles.
// Shape:
// { "bp": boolean,
// "weight": boolean,
// "pulse": boolean,
// "bmi": boolean,
// "mood": boolean, // privacy-sensitive; default OFF
// "compliance": boolean,
// "sleep": boolean }
// Null = documented defaults (every section ON except mood). Mood is
// opt-in by default — the API layer drops mood entirely from the
// payload when the toggle is off so the data never leaves the DB row.
doctorReportPrefsJson Json? @map("doctor_report_prefs_json")
// Relations
passkeys Passkey[]
sessions Session[]