Files
sorsfonalak/crates/db/migrations/0040_forum_notifications.sql
T
fecoandClaude Opus 5.5 7c768fccff Forum: e-mail notifications with a daily digest
Members choose per kind: replies to them (daily digest, instant or off),
new posts in followed threads (daily or off), private messages and
requests (instant or off). The forum service queues the instant e-mails
(none while online, at most one per thread an hour); the worker's new
forum task makes the evening digest of what is unread. Every forum e-mail
greets by the nickname and has a one-click unsubscribe (RFC 8058).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
2026-11-26 10:59:29 +00:00

13 lines
929 B
SQL

-- Forum e-mail notifications (docs/kozosseg.md), each switched by the member:
-- replies to them (instant, a daily digest, or off), new posts in followed
-- threads (daily or off), private messages and requests (instant or off).
-- The token is the one-click unsubscribe link of these e-mails.
ALTER TABLE forum.members
ADD COLUMN email_replies text NOT NULL DEFAULT 'daily' CHECK (email_replies IN ('off', 'daily', 'instant')),
ADD COLUMN email_followed text NOT NULL DEFAULT 'off' CHECK (email_followed IN ('off', 'daily')),
ADD COLUMN email_messages text NOT NULL DEFAULT 'instant' CHECK (email_messages IN ('off', 'instant')),
-- When the last daily digest was made (the worker's forum task).
ADD COLUMN digest_sent_at timestamptz,
ADD COLUMN email_token text NOT NULL DEFAULT replace(gen_random_uuid()::text, '-', '');
CREATE UNIQUE INDEX members_email_token_key ON forum.members (email_token);