Skip to content

Commit

Permalink
dcrdata/db/dcrpg: Assign error from storeVers to err variable before …
Browse files Browse the repository at this point in the history
…error check (#1998)

Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
  • Loading branch information
ukane-philemon authored Sep 23, 2024
1 parent c78b2bd commit 3dc6daa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions db/dcrpg/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func updateSchemaVersion(db *sql.DB, schema uint32) error {
return err
}

func updateMaintVersion(db *sql.DB, maint uint32) error {
func updateMaintenanceVersion(db *sql.DB, maint uint32) error {
_, err := db.Exec(internal.SetDBMaintenanceVersion, maint)
return err
}
Expand Down Expand Up @@ -321,7 +321,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
}
current.maint++
if err = updateMaintVersion(u.db, current.maint); err != nil {
if err = updateMaintenanceVersion(u.db, current.maint); err != nil {
return false, fmt.Errorf("failed to update maintenance version: %v", err)
}
fallthrough
Expand All @@ -338,7 +338,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -351,7 +351,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -364,7 +364,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -377,7 +377,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -390,7 +390,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -403,7 +403,7 @@ func (u *Upgrader) compatVersion1Upgrades(current, target DatabaseVersion) (bool
}
current.schema++
current.maint = 0
if storeVers(u.db, &current); err != nil {
if err = storeVers(u.db, &current); err != nil {
return false, err
}

Expand All @@ -427,7 +427,7 @@ func storeVers(db *sql.DB, dbVer *DatabaseVersion) error {
if err != nil {
return fmt.Errorf("failed to update schema version: %w", err)
}
err = updateMaintVersion(db, dbVer.maint)
err = updateMaintenanceVersion(db, dbVer.maint)
return fmt.Errorf("failed to update maintenance version: %w", err)
}

Expand Down

0 comments on commit 3dc6daa

Please sign in to comment.