taskcafe/migrations/0053_add-notification-tables.up.sql
2020-09-11 19:29:41 -05:00

16 lines
568 B
SQL

CREATE TABLE notification_object (
notification_object_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
entity_id uuid NOT NULL,
action_type int NOT NULL,
actor_id uuid NOT NULL,
entity_type int NOT NULL,
created_on timestamptz NOT NULL
);
CREATE TABLE notification (
notification_id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
notification_object_id uuid REFERENCES notification_object(notification_object_id) ON DELETE CASCADE,
notifier_id uuid NOT NULL REFERENCES user_account(user_id) ON DELETE CASCADE,
read boolean NOT NULL DEFAULT false
);