X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/fac6ba761f971deb77a5686ead99ec6534f931d2..95b037f55a21f6bd70c50801f5c6b0a23daee27c:/widget/comments.sql

diff --git a/widget/comments.sql b/widget/comments.sql
index 2a4993b..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,
@@ -27,3 +27,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
+);
