X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/55cb3025c5506ec7faaa1818a4d8161aaad19c27..04a1a7a24edbf8423a48f51609d545a5a7a3eb42:/widget/comments.sql?ds=inline

diff --git a/widget/comments.sql b/widget/comments.sql
index 5e33716..a152079 100644
--- a/widget/comments.sql
+++ b/widget/comments.sql
@@ -4,15 +4,33 @@ 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,
 	id         serial      NOT NULL PRIMARY KEY
 );
 
 CREATE TABLE comments (
 	page       text,
+	raw        text,
 	message    text,
 	created    timestamptz DEFAULT now(),
 	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
+);
