2021-10-26 21:42:04 +02:00
|
|
|
DROP TABLE notification_object CASCADE;
|
|
|
|
DROP TABLE notification CASCADE;
|
|
|
|
|
|
|
|
CREATE TABLE notification (
|
|
|
|
notification_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
2021-10-27 04:29:49 +02:00
|
|
|
caused_by uuid NOT NULL,
|
|
|
|
action_type text NOT NULL,
|
2021-10-26 21:42:04 +02:00
|
|
|
data jsonb,
|
|
|
|
created_on timestamptz NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE notification_notified (
|
|
|
|
notified_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
|
|
notification_id uuid REFERENCES notification(notification_id) ON DELETE CASCADE,
|
|
|
|
user_id uuid NOT NULL REFERENCES user_account(user_id) ON DELETE CASCADE,
|
|
|
|
read boolean NOT NULL DEFAULT false,
|
|
|
|
read_at timestamptz
|
|
|
|
);
|