18 lines
801 B
SQL
18 lines
801 B
SQL
-- CFG-04: Benachrichtigungspraeferenzen je Benutzer, Ereignistyp und Kanal.
|
|
-- Lebt wie notification_templates/in_app_notifications (CFG-03) in der
|
|
-- Registry-DB — modulübergreifende Konfiguration, keine Mandanten-Geschaeftsdaten.
|
|
--
|
|
-- Kein Row = aktiviert (Opt-out-Modell): ein Benutzer verpasst nichts, bis er
|
|
-- aktiv einen Kanal/Ereignistyp abschaltet — sicherer Default als Opt-in.
|
|
CREATE TABLE notification_preferences (
|
|
tenant_slug TEXT NOT NULL,
|
|
user_id TEXT NOT NULL,
|
|
event_type TEXT NOT NULL,
|
|
channel TEXT NOT NULL,
|
|
enabled BOOLEAN NOT NULL,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (tenant_slug, user_id, event_type, channel)
|
|
);
|
|
|
|
CREATE INDEX notification_preferences_tenant_idx ON notification_preferences (tenant_slug);
|