X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/fac6ba761f971deb77a5686ead99ec6534f931d2..3671d53f7cdf7bfbf628d7d5adbb2e2847450fb9:/widget/comments.sql?ds=sidebyside

diff --git a/widget/comments.sql b/widget/comments.sql
index 2a4993b..a152079 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,
@@ -13,6 +13,7 @@ CREATE TABLE issues (
 
 CREATE TABLE comments (
 	page       text,
+	raw        text,
 	message    text,
 	created    timestamptz DEFAULT now(),
 	author     text,
@@ -27,3 +28,9 @@ CREATE TABLE journal (
 	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
+);
