Skip to content

Commit

Permalink
fix: must update version if upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 10, 2022
1 parent f692e6c commit 220cd4d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/bootstrap/data/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@ func initSettings() {
for i := range initialSettingItems {
v := initialSettingItems[i]
_, err := db.GetSettingItemByKey(v.Key)
if err == nil {
continue
}
if errors.Is(err, gorm.ErrRecordNotFound) {
if errors.Is(err, gorm.ErrRecordNotFound) || v.Key == conf.VERSION {
err = db.SaveSettingItem(v)
if err != nil {
log.Fatalf("failed create setting: %+v", err)
}
} else {
} else if err != nil {
log.Fatalf("failed get setting: %+v", err)
}
}
Expand Down

0 comments on commit 220cd4d

Please sign in to comment.