Skip to content

Commit

Permalink
add v2-upgrade-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 committed Jan 16, 2024
1 parent b7af403 commit 593ff2c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/OmniFlix/omniflixhub/v2/app/upgrades"
v012 "github.com/OmniFlix/omniflixhub/v2/app/upgrades/v012"
v2 "github.com/OmniFlix/omniflixhub/v2/app/upgrades/v2"
v2testnetpatch1 "github.com/OmniFlix/omniflixhub/v2/app/upgrades/v2-testnet-patch-1"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

Expand All @@ -72,7 +73,7 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string
Upgrades = []upgrades.Upgrade{v012.Upgrade, v2.Upgrade}
Upgrades = []upgrades.Upgrade{v012.Upgrade, v2.Upgrade, v2testnetpatch1.Upgrade}
Forks []upgrades.Fork
)

Expand Down
16 changes: 16 additions & 0 deletions app/upgrades/v2-testnet-patch-1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package v2_testnet_patch_1

import (
"github.com/OmniFlix/omniflixhub/v2/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
)

const UpgradeName = "v2-testnet-patch-1"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateV2UpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
},
}
30 changes: 30 additions & 0 deletions app/upgrades/v2-testnet-patch-1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package v2_testnet_patch_1

import (
"github.com/OmniFlix/omniflixhub/v2/app/keepers"
"github.com/OmniFlix/omniflixhub/v2/app/upgrades"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateV2UpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
_ upgrades.BaseAppParamManager,
_ *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("running migrations ...")

// Run migrations before applying any other state changes.
// NOTE: DO NOT PUT ANY STATE CHANGES BEFORE RunMigrations().
versionMap, err := mm.RunMigrations(ctx, cfg, fromVM)
if err != nil {
return nil, err
}

ctx.Logger().Info("Upgrade complete")
return versionMap, nil
}
}

0 comments on commit 593ff2c

Please sign in to comment.