issue/report: activity widget to list latest messages
[minimedit.git] / widget / comments.sql
index 2a4993b056eb5062d7bfd0e7a10f7301493a394e..3a5fcfc2fc6765c262ee484c012c9398379649bc 100644 (file)
@@ -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
+);