summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
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