Files
HealthLog/prisma/migrations/0143_v1160_self_context_fields/migration.sql
T
Marc-André Bombeck 5b75184649 feat(coach,admin): finish the self-context and invite surfaces end to end
Invites move into their own admin section with a real ledger: status
badges, expiry, uses, a redemption history of who joined when (new
redemption table, revocation is now soft so history survives), and an
honest one-time link/QR moment. The assistant self-context grows
structured fields for conditions, allergies and focus — encrypted like
the free text — merges age and gender from the profile into one fenced
prompt block, and asks up to three targeted follow-up questions that
surface as tappable chips above the coach composer. A fourth nudge
trigger gently suggests a check-up when the self-context is stale and
the coach is actually in use.
2026-06-10 16:18:48 +02:00

18 lines
997 B
SQL

-- v1.16.0 — structured self-context fields on the health profile.
--
-- Three short structured companions to the free-text "about me"
-- (chronic conditions, allergies/intolerances, what the Coach should
-- watch), each encrypted at rest through the shared Bytes codec and
-- capped at 500 chars BEFORE encryption. Age/gender deliberately do
-- NOT live here — they come from the users table and are merged into
-- the prompt block at assembly time.
--
-- `pending_questions_encrypted` carries up to 3 clarifying questions
-- the server derives after a save (encrypted JSON string[]); the Coach
-- composer renders them as tappable suggestion chips. Additive +
-- non-destructive.
ALTER TABLE "user_health_profiles" ADD COLUMN "conditions_encrypted" BYTEA;
ALTER TABLE "user_health_profiles" ADD COLUMN "allergies_encrypted" BYTEA;
ALTER TABLE "user_health_profiles" ADD COLUMN "coach_focus_encrypted" BYTEA;
ALTER TABLE "user_health_profiles" ADD COLUMN "pending_questions_encrypted" BYTEA;