nordabiz/database/migrations/063_add_notify_email_messages.sql
Maciej Pienczyn 97416ffdc1
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
feat: email notification when receiving private message with opt-out toggle
- New column: users.notify_email_messages (default true)
- Send email via MS Graph when someone receives a private message
- Toggle in /konto/prywatnosc to enable/disable email notifications
- Email includes message preview, sender name, and direct link

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 09:13:57 +01:00

17 lines
554 B
SQL

-- Migration 063: Add email notification preference for private messages
-- Default TRUE so existing users get notified (they can opt-out)
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM information_schema.columns
WHERE table_name = 'users'
AND column_name = 'notify_email_messages'
) THEN
ALTER TABLE users ADD COLUMN notify_email_messages BOOLEAN DEFAULT TRUE;
RAISE NOTICE 'Added notify_email_messages column';
ELSE
RAISE NOTICE 'notify_email_messages column already exists';
END IF;
END $$;