Files
HealthLog/prisma/migrations/0058_user_research_mode/migration.sql
T
Marc-André Bombeck 17b8d8d2c2 chore(release): v1.4.25
Largest feature delta in the v1.4.x line. Insights expands into seven dedicated metric sub-pages; GLP-1 medication tracking lands end-to-end (drug-level chart with Research Mode acknowledgment, EMA titration ladder, cadence + compliance, side-effect taxonomy, pen/vial inventory); cross-source priority becomes a two-axis resolver; per-user timezone threads through ten analytics surfaces; Withings activity + sleep v2 sync; onboarding rebuilt as a nested-route wizard; Personal Records ship end-to-end; Health Score provenance accordion; Coach runs native first-party prompts across six locales with a 1800-assertion refusal-probe matrix; OpenAPI drift gate hard-fails; multi-arch GHCR image. Migrations 0043 through 0060 are additive and forward-only. PROMPT_VERSION 4.24.0 → 4.25.0 with GROUND RULE 9 (refuses dose recommendations) and GROUND RULE 15 (refuses drug-level estimates with MDR + MDCG 2021-24 cites).

See CHANGELOG.md for the full per-section delta.
2026-05-14 23:49:32 +02:00

36 lines
2.0 KiB
SQL

-- v1.4.25 W19c — Research Mode acknowledgment fields.
--
-- Adds three columns to the `users` table that together gate the
-- opt-in GLP-1 PK research-view chart behind an undismissable
-- MDR-disclaimer dialog (research §2.3 + §11). The chart never
-- renders unless `research_mode_enabled = true`, and the dialog
-- only flips that flag after the user explicitly acknowledges the
-- disclaimer copy at a specific version.
--
-- research_mode_enabled — master on/off switch.
-- Default `false` keeps the
-- chart hidden for every
-- existing user.
-- research_mode_acknowledged_at — timestamp of the most
-- recent acknowledgment.
-- NULL when the user has
-- never acknowledged.
-- research_mode_acknowledged_version — string identifier of the
-- disclaimer copy version
-- the user acknowledged
-- (e.g. "2026-05-14.1"). The
-- Settings UI re-prompts when
-- the version drifts ahead
-- of the persisted value, so
-- copy updates cannot quietly
-- keep the chart visible.
--
-- The `IF NOT EXISTS` guards make the migration idempotent — if any
-- column landed via a prior dev-DB hand-edit, the migration still
-- runs cleanly to completion (mirrors the 0057 onboarding-step
-- migration's posture).
ALTER TABLE "users"
ADD COLUMN IF NOT EXISTS "research_mode_enabled" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN IF NOT EXISTS "research_mode_acknowledged_at" TIMESTAMP(3),
ADD COLUMN IF NOT EXISTS "research_mode_acknowledged_version" TEXT;