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