aboutsummaryrefslogtreecommitdiffhomepage
path: root/apioforum/db.py
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-08-18 23:54:49 +0000
committerubq323 <ubq323>2021-08-18 23:54:49 +0000
commitd2e51e7b8bb2f765e79c98f13165b0faf59a302c (patch)
tree8b5972c5e05d44cfabca011fab50399c04ca5456 /apioforum/db.py
parentc51c87b6d012c2a250054b47e330e1c504aebb4a (diff)
parent17357a3fb5cf603ff79daad644f4a4c0fbe42150 (diff)
merge trunk into this
Diffstat (limited to 'apioforum/db.py')
-rw-r--r--apioforum/db.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/apioforum/db.py b/apioforum/db.py
index 50b142e..c0c8c7e 100644
--- a/apioforum/db.py
+++ b/apioforum/db.py
@@ -171,6 +171,42 @@ DROP TABLE tags;
ALTER TABLE tags_new RENAME TO tags;
PRAGMA foreign_keys = on;
""",
+"""
+CREATE TABLE role_config (
+ role TEXT NOT NULL,
+ forum NOT NULL REFERENCES forums(id),
+ id INTEGER PRIMARY KEY,
+
+ p_create_threads INT NOT NULL DEFAULT 1,
+ p_reply_threads INT NOT NULL DEFAULT 1,
+ p_view_threads INT NOT NULL DEFAULT 1,
+ p_manage_threads INT NOT NULL DEFAULT 0,
+ p_delete_posts INT NOT NULL DEFAULT 0,
+ p_vote INT NOT NULL DEFAULT 1,
+ p_create_polls INT NOT NULL DEFAULT 1,
+ p_approve INT NOT NULL DEFAULT 0,
+ p_create_subforum INT NOT NULL DEFAULT 0
+);
+
+INSERT INTO role_config (role,forum) VALUES ("approved",1);
+INSERT INTO role_config (role,forum) VALUES ("other",1);
+""",
+"""
+CREATE TABLE role_assignments (
+ user NOT NULL REFERENCES users(username),
+ forum NOT NULL REFERENCES forums(id),
+ role TEXT NOT NULL
+);
+""",
+"""
+ALTER TABLE posts ADD COLUMN deleted NOT NULL DEFAULT 0;
+""",
+"""
+ALTER TABLE forums ADD COLUMN unlisted NOT NULL DEFAULT 0;
+""",
+"""
+ALTER TABLE role_config ADD COLUMN p_view_forum INT NOT NULL DEFAULT 1;
+"""
]
def init_db():