diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-03-14 21:05:18 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-03-14 21:05:18 +0100 |
commit | 29ec6a5994b48330e2fe99a746bf105dd766f96f (patch) | |
tree | dacd7a837b7a35f9832ab8d878115a810150fb70 /schema.sql | |
parent | c845cf1dd1ee012121954799169a5c60581494bd (diff) |
Add article summary page.
Diffstat (limited to 'schema.sql')
-rw-r--r-- | schema.sql | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; |