summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-08-14 10:35:24 +0200
committerYorhel <git@yorhel.nl>2020-08-14 10:35:26 +0200
commitf32a4b4f3038a4eed239b9b857aefd70281e076f (patch)
tree2f939a495419f7d980302be82c005ae5e46f111d /util
parente009eace18e259a60fe65ca0e25d156816d55f42 (diff)
reviews: Add schema & display for comments
Not really sure how to integrate and handle this, to be honest. I'll just play around and see what works.
Diffstat (limited to 'util')
-rw-r--r--util/updates/wip-reviews.sql13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/updates/wip-reviews.sql b/util/updates/wip-reviews.sql
index c9699ab2..82b6f327 100644
--- a/util/updates/wip-reviews.sql
+++ b/util/updates/wip-reviews.sql
@@ -14,6 +14,17 @@ CREATE TABLE reviews (
spoiler boolean NOT NULL
);
+CREATE TABLE reviews_posts (
+ id vndbid NOT NULL,
+ num smallint NOT NULL,
+ uid integer,
+ date timestamptz NOT NULL DEFAULT NOW(),
+ edited timestamptz,
+ hidden boolean NOT NULL DEFAULT FALSE,
+ msg text NOT NULL DEFAULT '',
+ PRIMARY KEY(id, num)
+);
+
CREATE TABLE reviews_votes (
id vndbid NOT NULL,
uid int,
@@ -28,6 +39,8 @@ CREATE UNIQUE INDEX reviews_votes_id_uid ON reviews_votes (id,uid);
ALTER TABLE reviews ADD CONSTRAINT reviews_vid_fkey FOREIGN KEY (vid) REFERENCES vn (id) ON DELETE CASCADE;
ALTER TABLE reviews ADD CONSTRAINT reviews_uid_fkey FOREIGN KEY (uid) REFERENCES users (id) ON DELETE SET DEFAULT;
ALTER TABLE reviews ADD CONSTRAINT reviews_rid_fkey FOREIGN KEY (rid) REFERENCES releases (id) ON DELETE SET DEFAULT;
+ALTER TABLE reviews_posts ADD CONSTRAINT reviews_posts_id_fkey FOREIGN KEY (id) REFERENCES reviews (id) ON DELETE CASCADE;
+ALTER TABLE reviews_posts ADD CONSTRAINT reviews_posts_uid_fkey FOREIGN KEY (uid) REFERENCES users (id) ON DELETE SET DEFAULT;
ALTER TABLE reviews_votes ADD CONSTRAINT reviews_votes_id_fkey FOREIGN KEY (id) REFERENCES reviews (id) ON DELETE CASCADE;
ALTER TABLE reviews_votes ADD CONSTRAINT reviews_votes_uid_fkey FOREIGN KEY (uid) REFERENCES users (id) ON DELETE CASCADE;