fix(db/migration): avoid fatal error from being overwritten (#10316)

This commit is contained in:
Oscar Zhou
2023-09-18 14:33:04 +12:00
committed by GitHub
parent e3a4b7ad17
commit cc37ccfe4d
2 changed files with 6 additions and 6 deletions

View File

@@ -51,9 +51,9 @@ func (store *Store) MigrateData() error {
err = errors.Wrap(err, "failed to migrate database")
log.Warn().Err(err).Msg("migration failed, restoring database to previous version")
err = store.restoreWithOptions(&BackupOptions{BackupPath: backupPath})
if err != nil {
return errors.Wrap(err, "failed to restore database")
restorErr := store.restoreWithOptions(&BackupOptions{BackupPath: backupPath})
if restorErr != nil {
return errors.Wrap(restorErr, "failed to restore database")
}
log.Info().Msg("database restored to previous version")