Skip to content

Commit

Permalink
feat: start ledger v2.2 even in migration not terminated
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Jan 14, 2025
1 parent 160d0e3 commit c575374
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/resources/ledgers/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,19 @@ func Reconcile(ctx Context, stack *v1beta1.Stack, ledger *v1beta1.Ledger, versio
}

if isV2 && databases.GetSavedModuleVersion(database) != version {
if err := migrate(ctx, stack, ledger, database, image, version); err != nil {
err := migrate(ctx, stack, ledger, database, image, version)
if err != nil {
isV2_2 := !semver.IsValid(version) || semver.Compare(version, "v2.2.0-alpha.1") > 0
if !isV2_2 {
return err
}

if IsApplicationError(err) { // Start the ledger even if migrations are not terminated
return installLedger(ctx, stack, ledger, database, image, version, isV2)
}

return err
}

if err := databases.SaveModuleVersion(ctx, database, version); err != nil {
return errors.Wrap(err, "saving module version in database object")
}
Expand Down

0 comments on commit c575374

Please sign in to comment.