summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-07-23 14:29:27 +0200
committerYorhel <git@yorhel.nl>2020-07-23 14:29:31 +0200
commit5ed819ce09bb2da4d143fd6aba7a20bf8f08ff93 (patch)
tree93293cee0175cecd47cae141480ebc26dcceec6a /util
parente4cb4db6e3bd22dbb9f14d632b595c217e67df6d (diff)
Add new reporting feature
So that users can bring up problems to the moderators. Only used for forum posts for now, but I intend to extend it to other parts of the site as well.
Diffstat (limited to 'util')
-rw-r--r--util/updates/2020-07-23-reports.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/updates/2020-07-23-reports.sql b/util/updates/2020-07-23-reports.sql
new file mode 100644
index 00000000..1738fd72
--- /dev/null
+++ b/util/updates/2020-07-23-reports.sql
@@ -0,0 +1,19 @@
+CREATE TYPE report_status AS ENUM ('new', 'busy', 'done', 'dismissed');
+CREATE TYPE report_type AS ENUM ('t');
+
+CREATE TABLE reports (
+ id SERIAL PRIMARY KEY,
+ date timestamptz NOT NULL DEFAULT NOW(),
+ lastmod timestamptz,
+ uid integer, -- user who created the report, if logged in
+ ip inet, -- IP address of the visitor, if not logged in
+ reason text NOT NULL,
+ rtype report_type NOT NULL,
+ status report_status NOT NULL DEFAULT 'new',
+ object text NOT NULL, -- The id of the thing being reported
+ message text NOT NULL,
+ log text NOT NULL DEFAULT ''
+);
+CREATE INDEX reports_status ON reports (status,id);
+
+\i sql/perms.sql