Files
HealthLog/prisma/migrations/0057_user_onboarding_step/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

29 lines
1.4 KiB
SQL

-- v1.4.25 W14b — onboarding wizard resume-state.
--
-- Adds `onboarding_step` to the `users` table so the rebuilt multi-step
-- wizard at `/onboarding/[step]` can resume the user at the highest
-- step they reached. Without this column, closing the tab mid-flow
-- wipes progress and forces users back to step 0.
--
-- Step encoding (mirrors `src/components/onboarding/OnboardingShell.tsx`
-- and `src/app/onboarding/[step]/page.tsx`):
-- 0 = welcome (carousel / value-prop intro)
-- 1 = goals ("what do you want to track?")
-- 2 = source ("connect a source" — Withings / Apple Health / manual)
-- 3 = baseline (first measurement / sync confirmation)
-- 4 = done (success screen; same write that flips
-- `onboarding_completed_at` from NULL to NOW())
--
-- Existing rows are backfilled to 0 by PostgreSQL's fast-path
-- `ADD COLUMN ... DEFAULT` (PG11+), which materialises the default
-- without rewriting the table — every pre-W14b user lands at step 0
-- in O(1) time. The column ships nullable purely so the DDL stays
-- additive on every replica; Migration 0060 follows up by flipping
-- it to NOT NULL once the deploy has rolled.
--
-- The `IF NOT EXISTS` guards make the migration idempotent — if the
-- column landed via a prior dev-DB hand-edit, the migration still
-- runs cleanly to completion.
ALTER TABLE "users"
ADD COLUMN IF NOT EXISTS "onboarding_step" INTEGER DEFAULT 0;