From 5b756f01f23e64528dcdf0474a3e69b1172711d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 14 Jun 2026 23:21:39 +0200 Subject: [PATCH] feat(onboarding): add User.onboardingGoals for goal persistence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../0163_v1171_onboarding_goals/migration.sql | 15 +++++++++++++++ prisma/schema.prisma | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 prisma/migrations/0163_v1171_onboarding_goals/migration.sql diff --git a/prisma/migrations/0163_v1171_onboarding_goals/migration.sql b/prisma/migrations/0163_v1171_onboarding_goals/migration.sql new file mode 100644 index 000000000..2eba45587 --- /dev/null +++ b/prisma/migrations/0163_v1171_onboarding_goals/migration.sql @@ -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[]; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 715611d14..7ca1c51e8 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -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