-- ===================================================================== -- TeeCup — e-post-fallback for varsler, per type (migrasjon 033, -- 2026-07-28 oppfølging av varslingssenteret) -- ===================================================================== -- Trygg standard: en bruker som ikke har gjort noe valg får ALDRI e-post -- (samme "se ingenting"-filosofi som resten av appen, ADR-018/036) -- -- raden i user_notification_email_pref må EKSPLISITT finnes for at -- create_notification() (app/routers/notifications.py) skal sende e-post -- for akkurat den typen. Samme "tilstedeværelse = valgt"-mønster som -- round_visible_category (032) og friend_categorization (025) -- ingen -- egen boolean-kolonne per type, en rad per (bruker, type) i stedet. \set ON_ERROR_STOP on CREATE TABLE user_notification_email_pref ( user_id uuid NOT NULL REFERENCES app_user(id) ON DELETE CASCADE, -- Samme faste sett som notification.type (026_notifications.sql). type text NOT NULL CHECK (type IN ('friend', 'tournament', 'round', 'result')), PRIMARY KEY (user_id, type) ); GRANT SELECT, INSERT, UPDATE, DELETE ON user_notification_email_pref TO teecup_app;