summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-07-08 01:19:35 +0000
committerubq323 <ubq323>2021-07-08 01:19:35 +0000
commite39b446e72c47d802c43bf40bdee8479f231b17d (patch)
tree7e1cfd106274c968075cb60ff1b447134b195c2a
parent13ef3cb6d3f25bcf4d3413b69cccc6f3117effd4 (diff)
-rw-r--r--apioforum/db.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/apioforum/db.py b/apioforum/db.py
index 10b2c24..bb31084 100644
--- a/apioforum/db.py
+++ b/apioforum/db.py
@@ -142,7 +142,15 @@ CREATE TRIGGER default_roles AFTER INSERT ON forums BEGIN
INSERT INTO roles (role,forum) VALUES ('approved',new.id);
INSERT INTO roles (role,forum) VALUES ('other',new.id);
END;
-""",
+""",
+"""
+CREATE TABLE user_roles (
+ user TEXT NOT NULL REFERENCES users(username),
+ forum INTEGER NOT NULL REFERENCS forums(id),
+ role_name TEXT NOT NULL,
+ FOREIGN KEY (forum,role_name) REFERENCES roles(forum,name)
+);
+""",
]
def init_db():