X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/8f05d49e133e9ca27d20bfc3835fc08812a683cb..a7cf507fa0aa8b275979dbe98d3d0ef34fa7f05a:/widget/comments.sql diff --git a/widget/comments.sql b/widget/comments.sql index 8a06558..3a5fcfc 100644 --- a/widget/comments.sql +++ b/widget/comments.sql @@ -4,7 +4,7 @@ CREATE TABLE issues ( subject text, body text, created timestamptz DEFAULT now(), - closed timestamptz DEFAULT now(), + closed timestamptz, updated timestamptz NOT NULL DEFAULT now(), author text, assign text, @@ -18,3 +18,18 @@ CREATE TABLE comments ( author text, id serial NOT NULL PRIMARY KEY ); + +CREATE TABLE journal ( + comment_id integer NOT NULL REFERENCES comments (id), + property text NOT NULL DEFAULT 'attr', + col text NOT NULL, + old_value text, + value text, + id serial NOT NULL PRIMARY KEY +); + +CREATE OR REPLACE VIEW messages AS ( + SELECT *, regexp_replace(page, '.*/', '')::int issue FROM comments + UNION ALL + SELECT concat(page,'/',id), body, created, author, NULL, id FROM issues +);