diff options
-rw-r--r-- | apioforum/db.py | 10 |
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(): |