1+ -- Catalyst Event Database
2+
3+ -- ModerationAllocation - Defines the relationship between users and proposals_reviews
4+ -- to describe the allocation of moderations that needs to be done.
5+
6+ CREATE TABLE moderation_allocation (
7+ row_id SERIAL PRIMARY KEY ,
8+ review_id INTEGER NOT NULL ,
9+ user_id INTEGER NOT NULL ,
10+
11+ FOREIGN KEY (review_id) REFERENCES proposal_review(row_id) ON DELETE CASCADE ,
12+ FOREIGN KEY (user_id) REFERENCES config(row_id) ON DELETE CASCADE
13+ );
14+
15+
16+ COMMENT ON TABLE moderation_allocation IS ' The relationship between users and proposals_reviews.' ;
17+ COMMENT ON COLUMN moderation_allocation.row_id IS ' Synthetic ID of this relationship.' ;
18+ COMMENT ON COLUMN moderation_allocation.review_id IS ' The review the relationship is related to.' ;
19+ COMMENT ON COLUMN moderation_allocation.user_id IS ' The user the relationship is related to.' ;
20+
21+
22+ -- Moderation - Defines the moderation submitted by users for each proposal_review.
23+
24+ CREATE TABLE moderation (
25+ row_id SERIAL PRIMARY KEY ,
26+ review_id INTEGER NOT NULL ,
27+ user_id INTEGER NOT NULL ,
28+ classification INTEGER NOT NULL ,
29+ rationale VARCHAR ,
30+ UNIQUE (review_id, user_id),
31+
32+ FOREIGN KEY (review_id) REFERENCES proposal_review(row_id) ON DELETE CASCADE ,
33+ FOREIGN KEY (user_id) REFERENCES config(row_id) ON DELETE CASCADE
34+ );
35+
36+
37+ COMMENT ON TABLE moderation IS ' An individual moderation for a proposal review.' ;
38+ COMMENT ON COLUMN moderation.row_id IS ' Synthetic ID of this moderation.' ;
39+ COMMENT ON COLUMN moderation.review_id IS ' The review the moderation is related to.' ;
40+ COMMENT ON COLUMN moderation.user_id IS ' The user the moderation is submitted from.' ;
41+ COMMENT ON COLUMN moderation.classification IS ' The value used to describe the moderation (e.g. 0: excluded, 1: included).' ;
42+ COMMENT ON COLUMN moderation.rationale IS ' The rationale for the given classification.' ;
0 commit comments