Schema additions for the new digest-style reminder system:
paliad.users
- reminder_warning_offset_days INT NOT NULL DEFAULT 7, range 1..30
Per-user customisation of how many days before each deadline the heads-up
email fires. 7 matches the prior Monday-weekly behaviour.
- escalation_contact_id UUID NULL FK paliad.users(id) ON DELETE SET NULL
Optional override of the escalation channel for overdue / DRINGEND mail.
NULL means "fall back to global_admins". UI dropdown deferred to a
follow-up task per m's 2026-04-28 decision; column ships now to avoid
a second migration. Self-reference forbidden by CHECK constraint.
paliad.reminder_log
- slot TEXT NULL, slot_date DATE NULL — digest dedup keys.
- reminder_type CHECK widened to admit 'morning_digest' / 'evening_digest'
alongside the legacy 'overdue' / 'tomorrow' / 'weekly' values.
- Partial UNIQUE INDEX (user_id, slot, slot_date) WHERE slot IS NOT NULL
enforces "one digest per user per slot per local-date". Legacy rows
with slot IS NULL are unaffected.
CLAUDE.md updated with a §Phase status note pointing to the design doc
and explaining the deferred Settings-UI dropdown for escalation_contact_id.
Migration is fully additive and idempotent (IF NOT EXISTS / DROP-then-ADD
on named constraints). Down migration reverses the schema cleanly; any
'morning_digest' / 'evening_digest' rows must be deleted before downgrading.