X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/7718ed271465c8cd292f3b1d916e743db26d4ccd..193781e8df318bfb525afe01e1b2bfc92c2f9c2d:/widget/comments.sql

diff --git a/widget/comments.sql b/widget/comments.sql
index 3dc9f07..a152079 100644
--- a/widget/comments.sql
+++ b/widget/comments.sql
@@ -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
+);
