Files
perauset-e2e-mrfz8msi/sql/0008-notifications.sql
2026-07-11 08:21:55 +02:00

14 lines
412 B
SQL

CREATE TABLE app.notification (
notification_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES app."user"(user_id),
type TEXT NOT NULL,
title TEXT NOT NULL,
body TEXT,
entity_type TEXT,
entity_id UUID,
read_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX idx_notification_user ON app.notification(user_id, read_at, created_at DESC);