diff --git a/app/app.go b/app/app.go index f7e379be..f106d69f 100644 --- a/app/app.go +++ b/app/app.go @@ -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" ) @@ -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 ) diff --git a/app/upgrades/v2-testnet-patch-1/constants.go b/app/upgrades/v2-testnet-patch-1/constants.go new file mode 100644 index 00000000..6361e3db --- /dev/null +++ b/app/upgrades/v2-testnet-patch-1/constants.go @@ -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{}, + }, +} diff --git a/app/upgrades/v2-testnet-patch-1/upgrades.go b/app/upgrades/v2-testnet-patch-1/upgrades.go new file mode 100644 index 00000000..e985cedf --- /dev/null +++ b/app/upgrades/v2-testnet-patch-1/upgrades.go @@ -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 + } +}