From 4178a582e898898ccd7934391a21edb176490219 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 15 Aug 2022 17:36:01 -0400 Subject: [PATCH] Refactor more migration functions --- cmd/signaldctl/cmd/db/migrate.go | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/cmd/signaldctl/cmd/db/migrate.go b/cmd/signaldctl/cmd/db/migrate.go index 197a651..56e54e9 100644 --- a/cmd/signaldctl/cmd/db/migrate.go +++ b/cmd/signaldctl/cmd/db/migrate.go @@ -120,30 +120,10 @@ var ( migrate(moveGroups, "groups table") migrate(moveGroupCredentials, "group credentials table") migrate(moveContacts, "contacts table") - - if err := moveProfileKeys(source, dest); err != nil { - log.Println("error moving profile keys table") - return err - } - log.Println("moved profile keys table") - - if err := moveProfiles(source, dest); err != nil { - log.Println("error moving profiles tables") - return err - } - log.Println("moved profiles tables") - - if err := moveProfileCapabilities(source, dest); err != nil { - log.Println("error moving profile capabilities tables") - return err - } - log.Println("moved profile capabilities tables") - - if err := moveProfileBadges(source, dest); err != nil { - log.Println("error moving profile badges tables") - return err - } - log.Println("moved profile badges tables") + migrate(moveProfileKeys, "profile keys table") + migrate(moveProfiles, "profiles tables") + migrate(moveProfileCapabilities, "profile capabilities tables") + migrate(moveProfileBadges, "profile badges tables") if err := os.Remove(sqlitePath); err != nil { log.Println("error deleting sqlite file")