summaryrefslogtreecommitdiff
path: root/util/updates/2020-07-23-reports.sql
blob: 1738fd72dcab256b90be40fc14b1eafd71ec1e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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