summaryrefslogtreecommitdiffhomepage
path: root/apioforum/db.py
diff options
context:
space:
mode:
authorubq323 <ubq323>2021-07-22 17:36:30 +0000
committerubq323 <ubq323>2021-07-22 17:36:30 +0000
commit74a992ca018a69cc1de6225a681ca17c19c74ffa (patch)
tree521a2736c8fc8b207eea8e530792f88a974409af /apioforum/db.py
parentca9059374bae63dcf47b0ffcaa57b43ae608c309 (diff)
parent054e159a1183bbd328d24924e4478e7677fade42 (diff)
merge
Diffstat (limited to 'apioforum/db.py')
-rw-r--r--apioforum/db.py16
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():