Files
paliad/internal/db/migrations/015_user_role_open_and_dezernat.up.sql
m 7c44bbec7e refactor: onboarding form — drop Praxisgruppe, free-text role, add Dezernat (t-paliad-020)
- Drop the Praxisgruppe field from the onboarding form. Every Paliad user
  is in patent practice, so the field carried no signal. The DB column is
  retained for future use (set to NULL on insert).
- Switch role from a 4-value enum (partner/associate/pa/admin) to free
  text with a <datalist> of suggestions (Partner, Associate, PA, Of
  Counsel, Referendar/in, Trainee, wiss. Mitarbeiter/in, Sekretariat).
  German firms have many roles beyond the original four.
- Add an optional Dezernat field — the team led by a specific partner.
  Free text, no FK (the partner may not be registered yet).

Backend:
- Migration 015: drop the role enum CHECK, replace with non-empty CHECK;
  ADD COLUMN dezernat text.
- UserService.Create: drop validRoles map, require non-empty role string,
  trim and persist Dezernat. Admin bootstrap gate unchanged.
- models.User gains Dezernat *string; userColumns SELECT updated so
  /api/me returns it.

Frontend:
- onboarding.tsx: replace role <select> with <input list=...>; add
  dezernat input; remove practice_group.
- onboarding.ts: send dezernat (if non-empty), require role.
- i18n: add onboarding.role.placeholder, onboarding.dezernat[.placeholder],
  onboarding.error.role; remove the role.* enum and practice_group keys.
2026-04-18 20:26:11 +02:00

21 lines
815 B
SQL

-- Phase L: open up paliad.users.role from a fixed enum to free-text and add
-- the dezernat (partner team) column.
--
-- Rationale (m, 2026-04-18): German law firms have many roles beyond the
-- four originally enumerated (Of Counsel, Referendar/in, Trainee, wiss.
-- Mitarbeiter/in, Sekretariat, ...). The CHECK constraint is replaced by a
-- non-empty guard; the bootstrap admin gate stays in the service layer.
--
-- "Dezernat" is the team led by a specific partner. It is intentionally
-- free text — we cannot FK to paliad.users because the partner may not
-- have registered yet.
ALTER TABLE paliad.users
DROP CONSTRAINT IF EXISTS users_role_check;
ALTER TABLE paliad.users
ADD CONSTRAINT users_role_check CHECK (role <> '');
ALTER TABLE paliad.users
ADD COLUMN IF NOT EXISTS dezernat text;