From dd0cece91f3b5b083ea910650d7b40d44d887921 Mon Sep 17 00:00:00 2001
From: Matthias Andreas Benkard <code@mail.matthias.benkard.de>
Date: Sun, 27 May 2018 08:46:29 +0200
Subject: Add support for explicit journal keeping in the database.

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

(limited to 'schema.sql')

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,
-- 
cgit v1.2.1

