X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/c824b14c0f6fb372ca4e72fe244b3aade6c29541..f73f2c6c223577ad3cc6e14c0e6ff1567c910eae:/widget/comments.sql

diff --git a/widget/comments.sql b/widget/comments.sql
index 924c136..3a5fcfc 100644
--- a/widget/comments.sql
+++ b/widget/comments.sql
@@ -4,9 +4,10 @@ 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
 );
 
@@ -17,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
+);
