feat(onboarding): add User.onboardingGoals for goal persistence

The goals step let the user toggle goal slugs but both Skip and Next
discarded the selection — the picker was decorative. Add the
onboarding_goals text array the earlier dead code already referenced so
the selection can persist and seed dashboard tiles + reminder
suggestions. Not a clinical target store; targets stay fully derived
from height/age/gender in /api/insights/targets. Empty array = no
preference; purely-additive migration with an empty-array default, no
backfill.
This commit is contained in:
Marc-André Bombeck committed 2026-06-14 23:21:39 +02:00
1 parent 111fa7a323
commit 5b756f01f2
2 files changed
+24

No files matched your search

@@ -0,0 +1,15 @@
-- v1.17.1 — persist the onboarding goal selection.
--
-- The GoalsChipPicker step let the user toggle goal slugs, but both
-- Skip and Next discarded the selection — the picker was decorative.
-- This adds the `onboarding_goals` text array the dead code already
-- referenced, so the selection can seed dashboard tile pinning and
-- reminder suggestions.
--
-- Purely-additive: one new column on `users`, NOT NULL with a `'{}'`
-- (empty array) default, so every existing row keeps "no preference"
-- without a backfill pass. The column is a personalization seed, not a
-- clinical target store.
ALTER TABLE "users"
ADD COLUMN "onboarding_goals" TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[];
+9
View File
@@ -236,6 +236,15 @@ model User {
// round-trip — the column stays at 4 for completed users)
// Null = legacy pre-W14b user; the wizard treats null as 0 on mount.
onboardingStep Int @default(0) @map("onboarding_step")
// v1.17.1 — goal slugs chosen during onboarding (GoalsChipPicker).
// Seeds dashboard tile pinning + reminder suggestions; NOT a clinical
// target store (targets are fully derived from height/age/gender +
// clinical refs in /api/insights/targets). Empty [] = skipped / no
// preference. The slug set is the closed enum
// `ONBOARDING_GOAL_SLUGS` in src/lib/onboarding/goals.ts; a String[]
// (not a relation) mirrors `insightsExcludeMetrics` precedent — the
// set is small and fixed, never queried relationally.
onboardingGoals String[] @default([]) @map("onboarding_goals")
// v1.4.15 Phase B5: tracks whether the user has finished (or
// explicitly dismissed) the spotlight tour that overlays the
// dashboard on first arrival. Distinct from the wizard at