Files
HealthLog/prisma/migrations/0174_v1186_diabetes_opt_in/migration.sql
T
Marc-André Bombeck 2c87a93827 feat(glucose): add a diabetes opt-in preference
Introduce an explicit, user-declared "I have diabetes / clinician glucose
targets" preference (`User.hasDiabetes`, migration 0174, defaulted false) plus
its GET/PATCH endpoint at `/api/auth/me/diabetes`. The flag selects which
glucose target band a reading is judged against; it is never inferred from a
value and never asserts a diagnosis. Mirrors the existing per-user-scalar
preference pattern: 60/min rate limit, Zod validation, audit-logged,
field-by-field write. OpenAPI regenerated for the new route.
2026-06-18 20:17:13 +02:00

16 lines
785 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- v1.18.6 — diabetes opt-in for clinician glucose targets.
--
-- One additive, defaulted column on `users` so a user can declare "I have
-- diabetes / clinician glucose targets". When `true`, the glucose target
-- resolver applies the tighter ADA glycemic GOAL bands (fasting 80–130,
-- postprandial < 180) instead of the general non-diabetic normal bands.
--
-- This is NEVER auto-inferred from a reading and is NEVER a diagnosis — it is
-- a user-declared preference that only selects which target band the user is
-- judged against. The default `false` backfills every existing row onto the
-- general bands (the current behaviour), so the migration is a no-op for
-- anyone who never opts in.
ALTER TABLE "users"
ADD COLUMN "has_diabetes" BOOLEAN NOT NULL DEFAULT false;