Skip to content

Commit

Permalink
chore: try fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kioqq committed Dec 11, 2023
1 parent 2f990f5 commit 5896b06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ func (app *Haqq) setupUpgradeHandlers() {
}
case v164.UpgradeName:
storeUpgrades = &storetypes.StoreUpgrades{
Deleted: []string{coinomicstypes.ModuleName},
Added: []string{coinomicstypes.ModuleName},
}
default:
// no-op
Expand Down
12 changes: 12 additions & 0 deletions app/upgrades/v1.6.4/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const ModuleName = "coinomics"

// CreateUpgradeHandler creates an SDK upgrade handler for v1.6.4
func CreateUpgradeHandler(
mm *module.Manager,
Expand All @@ -15,6 +17,16 @@ func CreateUpgradeHandler(
logger := ctx.Logger()
logger.Info("run migration v1.6.4")

storeKey := sdk.NewKVStoreKey(ModuleName)
store := ctx.KVStore(storeKey)

iterator := sdk.KVStorePrefixIterator(store, nil)
defer iterator.Close()

for ; iterator.Valid(); iterator.Next() {
store.Delete(iterator.Key())
}

return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 5896b06

Please sign in to comment.