MySQL · 487 bytes Raw Blame History
1 -- SPDX-License-Identifier: AGPL-3.0-or-later
2
3 -- name: ListUserNotificationPrefs :many
4 SELECT user_id, key, value, updated_at
5 FROM user_notification_prefs
6 WHERE user_id = $1
7 ORDER BY key;
8
9 -- name: UpsertUserNotificationPref :exec
10 INSERT INTO user_notification_prefs (user_id, key, value)
11 VALUES ($1, $2, $3)
12 ON CONFLICT (user_id, key) DO UPDATE
13 SET value = EXCLUDED.value;
14
15 -- name: DeleteUserNotificationPref :exec
16 DELETE FROM user_notification_prefs WHERE user_id = $1 AND key = $2;
17