Files
MrAlders0n 90c2ece473 feat(alerts): email and push channels through the push server
Alerts go out by email, by push or both, as each user chooses. Push is
sent through the push server with the operator's Push ID and secret and
sealed per device, so this server no longer holds a Firebase key. The
outbox tracks each channel, so a retry of one never repeats the other.
2026-11-17 20:22:51 -05:00

15 lines
758 B
SQL

-- Copyright 2026 Beacon Contributors
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- Each user picks the channels alerts reach them by.
ALTER TABLE users ADD COLUMN alert_email boolean NOT NULL DEFAULT true;
ALTER TABLE users ADD COLUMN alert_push boolean NOT NULL DEFAULT true;
-- When a notice's mail went out, so retrying its push never sends the mail twice.
ALTER TABLE alert_outbox ADD COLUMN email_sent_at timestamp with time zone;
-- Push goes through the push server now: a device holds its handle there and the key its notices are sealed with.
-- Devices registered before have neither, so the apps register again.
DELETE FROM user_devices;
ALTER TABLE user_devices ADD COLUMN payload_key bytea NOT NULL CHECK (octet_length(payload_key) = 32);