2023-08-24 05:13:12 +00:00
|
|
|
-- Type: DO
|
|
|
|
|
-- Name: recommendation
|
|
|
|
|
-- Description: Create recommendation table
|
|
|
|
|
|
|
|
|
|
BEGIN;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE omnivore.recommendation (
|
|
|
|
|
id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
|
|
|
|
|
library_item_id uuid NOT NULL REFERENCES omnivore.library_item ON DELETE CASCADE,
|
|
|
|
|
recommender_id uuid NOT NULL REFERENCES omnivore.user ON DELETE CASCADE,
|
2023-09-18 14:52:54 +00:00
|
|
|
group_id uuid NOT NULL REFERENCES omnivore.group ON DELETE CASCADE,
|
2023-08-24 05:13:12 +00:00
|
|
|
note text,
|
2023-09-18 14:52:54 +00:00
|
|
|
created_at timestamptz NOT NULL DEFAULT current_timestamp,
|
|
|
|
|
UNIQUE (library_item_id, recommender_id, group_id)
|
2023-08-24 05:13:12 +00:00
|
|
|
);
|
|
|
|
|
|
2023-09-06 09:20:16 +00:00
|
|
|
GRANT SELECT, INSERT ON omnivore.recommendation TO omnivore_user;
|
2023-09-04 11:35:11 +00:00
|
|
|
|
2023-08-24 05:13:12 +00:00
|
|
|
COMMIT;
|