Pull Request #1847
Add notification preferences for users
Adds a user_notification_preferences table and a PUT endpoint so users can configure email and digest settings from their profile page.
Ready to merge
db/migration/V12_add_user_notification_preferences.sql+12 additions
1
+ CREATE TABLE user_notification_preferences (
2
+ id BIGSERIAL PRIMARY KEY,
3
+ user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
4
+ email_enabled BOOLEAN NOT NULL DEFAULT TRUE,
5
+ digest_frequency VARCHAR(20) NOT NULL DEFAULT 'daily',
6
+ notify_on_comment BOOLEAN NOT NULL DEFAULT TRUE,
7
+ notify_on_mention BOOLEAN NOT NULL DEFAULT TRUE,
8
+ created_at TIMESTAMP NOT NULL DEFAULT NOW()
9
+ );
10
+
11
+ CREATE UNIQUE INDEX uq_user_notification_prefs_user_id
12
+ ON user_notification_preferences(user_id);
Review comments ยท db/migration/V12_add_user_notification_preferences.sql