widget/reply: save raw message input before formatting
[minimedit.git] / widget / comments.sql
1 CREATE TABLE issues (
2         page       text        NOT NULL DEFAULT 'issue',
3         link       text,
4         subject    text,
5         body       text,
6         created    timestamptz          DEFAULT now(),
7         closed     timestamptz,
8         updated    timestamptz NOT NULL DEFAULT now(),
9         author     text,
10         assign     text,
11         id         serial      NOT NULL PRIMARY KEY
12 );
13
14 CREATE TABLE comments (
15         page       text,
16         raw        text,
17         message    text,
18         created    timestamptz DEFAULT now(),
19         author     text,
20         id         serial      NOT NULL PRIMARY KEY
21 );
22
23 CREATE TABLE journal (
24         comment_id integer     NOT NULL REFERENCES comments (id),
25         property   text        NOT NULL DEFAULT 'attr',
26         col        text        NOT NULL,
27         old_value  text,
28         value      text,
29         id         serial      NOT NULL PRIMARY KEY
30 );
31
32 CREATE OR REPLACE VIEW messages AS (
33         SELECT *, regexp_replace(page, '.*/', '')::int issue FROM comments
34                 UNION ALL
35         SELECT concat(page,'/',id), body, created, author, NULL, id FROM issues
36 );