From fc11f0949190dfbc8da1585a072027a2894130a7 Mon Sep 17 00:00:00 2001
From: Matthias Andreas Benkard <code@mail.matthias.benkard.de>
Date: Thu, 3 Mar 2011 17:34:57 +0100
Subject: Support article categories.

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

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 5e4c250..8f00df6 100644
--- a/schema.sql
+++ b/schema.sql
@@ -127,6 +127,27 @@ CREATE TABLE comment_revisions(
   CHECK (format IN ('text'))
 );
 
+CREATE TABLE categories(
+  id   SERIAL  NOT NULL,
+  name VARCHAR NOT NULL,
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE category_inclusions(
+  category      INTEGER NOT NULL,
+  supercategory INTEGER NOT NULL,
+  PRIMARY KEY (category, supercategory),
+  FOREIGN KEY (category)      REFERENCES categories,
+  FOREIGN KEY (supercategory) REFERENCES categories
+);
+
+CREATE TABLE article_category_memberships(
+  article  INTEGER NOT NULL,
+  category VARCHAR NOT NULL,
+  PRIMARY KEY (article, category),
+  FOREIGN KEY (article) REFERENCES articles
+);
+
 CREATE TABLE user_permissions(
   "user"     INTEGER NOT NULL,
   permission VARCHAR NOT NULL,
-- 
cgit v1.2.3

