Files
paliad/internal/db/migrations/064_users_forum_pref.down.sql
m 06bd276a9c feat(users/forum-pref): persisted Fristenrechner inbox-channel column
Adds paliad.users.forum_pref so /tools/fristenrechner can pre-narrow
the proceeding picker to the user's typical inbox channel without
re-asking on every visit. The new column threads through the User
model, the userColumns SELECT, and UpdateProfileInput so the existing
PATCH /api/me handler accepts it without a new endpoint.

Allowed values mirror the channel chips m named in t-paliad-157:

  - cms          → UPC
  - bea          → national-DE
  - posteingang  → national-DE (slower channel, same forums)

NULL means "no preference, picker shows everything"; URL ?inbox=
overrides per-visit (frontend lands in the next commit). The CHECK
constraint enforces the 3-value enum at the DB layer; isValidForumPref
mirrors it in the service so callers see a typed error instead of a
raw pq violation. Empty string in the PATCH body clears the
preference, consistent with the EscalationContactID convention.

Migration 064 applied to the live Supabase pool; tracker bumped to
v64 so the boot-time runner skips re-applying.

Refs m/paliad#15.
2026-05-08 16:23:12 +02:00

6 lines
245 B
SQL

-- Reverse t-paliad-157 / m/paliad#15: drops the persisted
-- Fristenrechner inbox-channel preference column.
ALTER TABLE paliad.users DROP CONSTRAINT IF EXISTS users_forum_pref_check;
ALTER TABLE paliad.users DROP COLUMN IF EXISTS forum_pref;