● Zion Boggan
repos/Drophawk/backend/migrations/20260101000006_notifications.sql
zionboggan.com ↗
15 lines · sql
History for this file →
1
CREATE TABLE notifications_log (
2
    id          BIGSERIAL PRIMARY KEY,
3
    drop_id     BIGINT REFERENCES drops(id) ON DELETE SET NULL,
4
    channel     TEXT NOT NULL CHECK (channel IN ('ntfy','telegram','email','browser')),
5
    title       TEXT NOT NULL,
6
    body        TEXT NOT NULL,
7
    priority    TEXT NOT NULL CHECK (priority IN ('min','low','default','high','urgent')),
8
    sent_at     TIMESTAMPTZ NOT NULL DEFAULT NOW(),
9
    success     BOOLEAN NOT NULL,
10
    response    TEXT,
11
    topic       TEXT
12
);
13
 
14
CREATE INDEX idx_notif_sent_desc ON notifications_log(sent_at DESC);
15
CREATE INDEX idx_notif_drop      ON notifications_log(drop_id);