internal/store/migrations/0009_notifications.up.sql
14 lines · 525 bytes
1CREATE TABLE notifications (
2 id INTEGER PRIMARY KEY,
3 recipient TEXT NOT NULL,
4 subject TEXT NOT NULL,
5 body TEXT NOT NULL,
6 attempts INTEGER NOT NULL DEFAULT 0,
7 next_attempt_at TEXT,
8 sent_at TEXT,
9 failed_at TEXT,
10 last_error TEXT,
11 created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
12);
13CREATE INDEX notifications_due ON notifications(next_attempt_at)
14 WHERE sent_at IS NULL AND failed_at IS NULL;