-- 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;
