Skip to content

Commit

Permalink
Fix migrate-1.9-1.10, ensure the board column is only filled when it …
Browse files Browse the repository at this point in the history
…didn't exist before yet + change constraint posts_4chan_id to posts_4chan_idboard
  • Loading branch information
sal-uva committed Sep 28, 2021
1 parent c0543e4 commit f241de8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions helper-scripts/migrate/migrate-1.9-1.10.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
else:
print(" adding 'board' column to 4chan posts table")
db.execute("ALTER TABLE posts_4chan ADD COLUMN board TEXT DEFAULT ''")

print(" Filling 'board' column")
db.execute("UPDATE posts_4chan SET board = ( SELECT board FROM threads_4chan WHERE id = posts_4chan.thread_id )")
print(" Filling 'board' column")
db.execute("UPDATE posts_4chan SET board = ( SELECT board FROM threads_4chan WHERE id = posts_4chan.thread_id )")

print(" Creating index")
db.execute("CREATE UNIQUE INDEX IF NOT EXISTS posts_4chan_id ON posts_4chan ( id, board )")
db.execute("CREATE UNIQUE INDEX IF NOT EXISTS posts_4chan_idboard ON posts_4chan ( id, board )")

0 comments on commit f241de8

Please sign in to comment.