chahinebrini d7efd627f5 feat(profile): Demographics employment-split + Pro-Trial-Reward + tests
- New Prisma migration 20260508_demographics_employment_split:
  ADD COLUMNS employment_status / shift_work / industry / job_tenure
  (legacy `profession` kept untouched)
- PATCH /api/profile/me/demographics:
  Zod-enums updated to match Frontend values (employed/self_employed/in_training/
  unemployed/retired/homemaking/other; jobTenure: less_1y/1_3y/3_5y/5_10y/more_10y)
- profile.ts db-layer: tryAwardProTrial covers new + legacy fields,
  withdrawDemographics nulls all (incl. legacy profession)
- Vitest: 8-line trial happy-path + guard rails (free+pro+legend+used) +
  zod-validation tests covering new enum boundaries

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 19:31:28 +02:00

14 lines
704 B
SQL

-- Demographics Employment Split — Phase D
-- Ersetzt `profession` (frei-text) durch strukturierte Berufs-Felder.
-- `profession`-Spalte bleibt als legacy (kein DROP) — Audit-Trail + kein Datenverlust.
--
-- Drift-Hinweis: Diese Migration wird via `pnpm prisma migrate deploy` auf
-- staging-/prod-DB gefahren. Lokal NICHT ausführen. Falls Drift erkannt wird:
-- pnpm prisma migrate resolve --applied 20260508_demographics_employment_split
ALTER TABLE "rebreak"."profiles"
ADD COLUMN IF NOT EXISTS "employment_status" TEXT,
ADD COLUMN IF NOT EXISTS "shift_work" BOOLEAN,
ADD COLUMN IF NOT EXISTS "industry" TEXT,
ADD COLUMN IF NOT EXISTS "job_tenure" TEXT;