From e7001c3bc4a7e1ec53d810cafbc90d7f2a624af5 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 5 Aug 2019 13:07:28 +0300 Subject: [PATCH] * config upgrade: sequential processing --- home/upgrade.go | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/home/upgrade.go b/home/upgrade.go index 2b781293..491e5a68 100644 --- a/home/upgrade.go +++ b/home/upgrade.go @@ -53,20 +53,23 @@ func upgradeConfig() error { func upgradeConfigSchema(oldVersion int, diskConfig *map[string]interface{}) error { switch oldVersion { case 0: - err := upgradeSchema0to3(diskConfig) + err := upgradeSchema0to1(diskConfig) if err != nil { return err } + fallthrough case 1: - err := upgradeSchema1to3(diskConfig) + err := upgradeSchema1to2(diskConfig) if err != nil { return err } + fallthrough case 2: err := upgradeSchema2to3(diskConfig) if err != nil { return err } + fallthrough case 3: err := upgradeSchema3to4(diskConfig) if err != nil { @@ -210,23 +213,3 @@ func upgradeSchema3to4(diskConfig *map[string]interface{}) error { return nil } - -// jump three schemas at once -- this time we just do it sequentially -func upgradeSchema0to3(diskConfig *map[string]interface{}) error { - err := upgradeSchema0to1(diskConfig) - if err != nil { - return err - } - - return upgradeSchema1to3(diskConfig) -} - -// jump two schemas at once -- this time we just do it sequentially -func upgradeSchema1to3(diskConfig *map[string]interface{}) error { - err := upgradeSchema1to2(diskConfig) - if err != nil { - return err - } - - return upgradeSchema2to3(diskConfig) -}