diff options
author | ubq323 <ubq323> | 2021-07-22 16:59:50 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-07-22 16:59:50 +0000 |
commit | dc65b43ddce195c2ed35f6b7a0c1a96d284e0d55 (patch) | |
tree | 378df8a3bd8f7ddc90cecb1b818d1245481ff79c /apioforum/db.py | |
parent | ca9059374bae63dcf47b0ffcaa57b43ae608c309 (diff) |
make tags be per-forum and have the thread config interface work with this
Diffstat (limited to 'apioforum/db.py')
-rw-r--r-- | apioforum/db.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apioforum/db.py b/apioforum/db.py index abcd774..50b142e 100644 --- a/apioforum/db.py +++ b/apioforum/db.py @@ -155,6 +155,22 @@ CREATE VIEW number_of_posts AS CREATE VIEW total_vote_counts AS SELECT poll, count(*) AS total_votes FROM votes WHERE current AND NOT is_retraction GROUP BY poll; """, +""" +PRAGMA foreign_keys = off; +BEGIN TRANSACTION; +CREATE TABLE tags_new ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + text_colour TEXT NOT NULL, + bg_colour TEXT NOT NULL, + forum INTEGER NOT NULL REFERENCES forums(id) +); +INSERT INTO tags_new (id,name,text_colour,bg_colour,forum) + SELECT id,name,text_colour,bg_colour,1 FROM tags; +DROP TABLE tags; +ALTER TABLE tags_new RENAME TO tags; +PRAGMA foreign_keys = on; +""", ] def init_db(): |