-- UnifiedPush device registrations (server-architecture-spec.md ยง3.8) and -- server-held keys. -- -- A device row is one phone's push subscription: the distributor-issued -- endpoint plus the Web Push keys its messages are encrypted for (RFC 8291). -- Keys are nullable for distributors that don't do Web Push encryption. ALTER TABLE devices ADD COLUMN name TEXT, ADD COLUMN p256dh TEXT, ADD COLUMN auth TEXT, ADD COLUMN last_push_at TIMESTAMPTZ, ADD COLUMN last_error TEXT; CREATE UNIQUE INDEX devices_user_id_endpoint_idx ON devices(user_id, endpoint); -- Keys the server generates for itself (currently the VAPID signing key), -- encrypted with CREDENTIAL_KEY like account passwords. CREATE TABLE server_keys ( name TEXT PRIMARY KEY, ciphertext BYTEA NOT NULL, nonce BYTEA NOT NULL, created_at TIMESTAMPTZ NOT NULL DEFAULT now() );