From 9a84d0dc7cb99abe40018f85f5aab34f7a4efda2 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 25 Jul 2019 09:53:53 -0400 Subject: [PATCH] upgrade all the db versions, not just one at a time --- docs/changelog.txt | 4 ++++ upgradedb.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index bf4c25c..f64af52 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,9 @@ changelog +-- 0.7.6 + ++ Fix a bug where upgrades would not complete in one step. + -- 0.7.5 + Fix a bug (introdcued 0.7.4) preventing new user creation from working. diff --git a/upgradedb.go b/upgradedb.go index ff761f8..5ed7096 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -88,26 +88,32 @@ func upgradedb() { doordie(db, "update honks set honker = ?, whofore = 2 where userid = ? and honker = '' and what = 'bonk'", h, u.UserID) } doordie(db, "update config set value = 8 where key = 'dbversion'") + fallthrough case 8: doordie(db, "alter table files add column local integer") doordie(db, "update files set local = 1") doordie(db, "update config set value = 9 where key = 'dbversion'") + fallthrough case 9: doordie(db, "drop table xonkers") doordie(db, "create table xonkers (xonkerid integer primary key, name text, info text, flavor text)") doordie(db, "create index idx_xonkername on xonkers(name)") doordie(db, "update config set value = 10 where key = 'dbversion'") + fallthrough case 10: doordie(db, "update zonkers set wherefore = 'zomain' where wherefore = 'zurl'") doordie(db, "update zonkers set wherefore = 'zord' where wherefore = 'zword'") doordie(db, "update config set value = 11 where key = 'dbversion'") + fallthrough case 11: doordie(db, "alter table users add column options text") doordie(db, "update users set options = ''") doordie(db, "update config set value = 12 where key = 'dbversion'") + fallthrough case 12: doordie(db, "create index idx_honksoonker on honks(oonker)") doordie(db, "update config set value = 13 where key = 'dbversion'") + fallthrough case 13: default: log.Fatalf("can't upgrade unknown version %d", dbversion)