targo-backend/prisma/postgres/scripts/create-table-notifications.sql

15 lines
476 B
SQL

CREATE TABLE notifications (
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
user_id uuid NOT NULL,
affected_module text,
subject text NOT NULL,
description text,
metadata jsonb,
created_at timestamptz NOT NULL DEFAULT now(),
viewed_at timestamptz NULL,
CONSTRAINT notifications_user_id_fkey
FOREIGN KEY (user_id)
REFERENCES users(id)
ON DELETE CASCADE
);