Files
Bookra/apps/backend/migrations/00004_notification_delivery_logs.sql
T
Tomas Dvorak 035ac8ddb5 first commit
2026-04-10 12:01:36 +02:00

21 lines
725 B
SQL

-- +goose Up
CREATE TABLE IF NOT EXISTS notification_delivery_logs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id uuid NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
reminder_job_id uuid REFERENCES reminder_jobs(id) ON DELETE SET NULL,
channel text NOT NULL,
provider text NOT NULL,
recipient text NOT NULL,
delivery_status text NOT NULL,
external_id text,
error_message text,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_notification_delivery_logs_tenant_time
ON notification_delivery_logs (tenant_id, created_at DESC);
-- +goose Down
DROP INDEX IF EXISTS idx_notification_delivery_logs_tenant_time;
DROP TABLE IF EXISTS notification_delivery_logs;