summaryrefslogtreecommitdiff
path: root/schema.sql
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2018-05-27 08:46:29 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2018-05-27 09:20:24 +0200
commitdd0cece91f3b5b083ea910650d7b40d44d887921 (patch)
tree5173058c62aa2dc4658636fdac6eebb726468708 /schema.sql
parent567f3ebbe6f60a872a57489516855b113315e341 (diff)
Add support for explicit journal keeping in the database.
Diffstat (limited to 'schema.sql')
-rw-r--r--schema.sql16
1 files changed, 16 insertions, 0 deletions
diff --git a/schema.sql b/schema.sql
index bb4a0db..6545da0 100644
--- a/schema.sql
+++ b/schema.sql
@@ -68,6 +68,22 @@ CREATE TABLE article_aliases(
FOREIGN KEY (article) REFERENCES articles
);
+CREATE TABLE journals(
+ id INTEGER NOT NULL,
+ path_prefix VARCHAR, --can be null to make the journal unreachable
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE journal_entries(
+ journal INTEGER NOT NULL,
+ index INTEGER NOT NULL,
+ article INTEGER NOT NULL,
+ PRIMARY KEY (journal, index),
+ FOREIGN KEY (article) REFERENCES articles,
+ FOREIGN KEY (journal) REFERENCES journals,
+ CHECK (index >= 0)
+);
+
CREATE TABLE comments(
id SERIAL NOT NULL,
article INTEGER NOT NULL,