summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-06-20 00:16:50 +0000
committerubq323 <ubq323>2021-06-20 00:16:50 +0000
commit0f87c795e31c88695a3e9ac2fff91d2b73a45233 (patch)
tree284f3ae3631f16b84343df0ab97ad71b6394decf
parent47b68768d6b13c93bc6f4544754427daa696f9d7 (diff)
add subforum schema things
-rw-r--r--apioforum/db.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/apioforum/db.py b/apioforum/db.py
index 910118d..ad6cd39 100644
--- a/apioforum/db.py
+++ b/apioforum/db.py
@@ -84,6 +84,17 @@ CREATE TABLE thread_tags (
ALTER TABLE users ADD COLUMN bio TEXT;
ALTER TABLE users ADD COLUMN joined TIMESTAMP;
""",
+"""
+CREATE TABLE forums (
+ id INTEGER PRIMARY KEY,
+ name TEXT NOT NULL,
+ parent INTEGER REFERENCES forums(id),
+ description TEXT
+);
+INSERT INTO forums (name,parent,description) values ('root',null,'the default root forum');
+ALTER TABLE threads ADD COLUMN forum NOT NULL DEFAULT 1 REFERENCES forums(id);
+""",
+
]
def init_db():