-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrations.go
37 lines (28 loc) · 907 Bytes
/
migrations.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/gridiron-zone/huddle/x/relationships/legacy/v2"
profilesv4 "github.com/gridiron-zone/huddle/x/profiles/legacy/v4"
v1 "github.com/gridiron-zone/huddle/x/relationships/legacy/v1"
)
// DONTCOVER
// Migrator is a struct for handling in-place store migrations.
type Migrator struct {
keeper Keeper
pk profilesv4.Keeper
}
// NewMigrator returns a new Migrator
func NewMigrator(keeper Keeper, pk profilesv4.Keeper) Migrator {
return Migrator{
keeper: keeper,
pk: pk,
}
}
// Migrate1To2 migrates from version 1 to 2.
func (m Migrator) Migrate1To2(ctx sdk.Context) error {
return v1.MigrateStore(ctx, m.pk, m.keeper.storeKey, m.keeper.cdc)
}
// Migrate1To2 migrates from version 2 to 3.
func (m Migrator) Migrate2To3(ctx sdk.Context) error {
return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
}