From 29ec6a5994b48330e2fe99a746bf105dd766f96f Mon Sep 17 00:00:00 2001
From: Matthias Andreas Benkard <code@mail.matthias.benkard.de>
Date: Mon, 14 Mar 2011 21:05:18 +0100
Subject: Add article summary page.

---
 schema.sql | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 17de70a..6eb4141 100644
--- a/schema.sql
+++ b/schema.sql
@@ -275,6 +275,11 @@ CREATE AGGREGATE most_recent_revision (article_revisions) (
 );
 
 
+CREATE OR REPLACE FUNCTION branch_tips(articles) AS $$
+  
+$$ LANGUAGE SQL STABLE;
+
+
 CREATE VIEW article_comment_counts AS
   SELECT a.id       AS article,
          count(c.*) AS comment_count
@@ -296,4 +301,14 @@ CREATE VIEW article_publishing_dates AS
    GROUP BY article;
 
 
+CREATE VIEW article_branch_tips AS
+  SELECT article              AS article,
+         article_revisions.id AS revision
+    FROM (SELECT id FROM article_revisions
+          EXCEPT
+          SELECT parent FROM article_revision_parenthood)
+      AS branch_tips
+    JOIN article_revisions USING (id);
+
+
 COMMIT;
-- 
cgit v1.2.3

