Skip to content

Commit

Permalink
fix: always move auth module migration to the end
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Nov 24, 2021
1 parent 792f388 commit af06f2f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion types/module/module.go
Expand Up @@ -395,10 +395,19 @@ func (m Manager) RunMigrations(ctx sdk.Context, cfg Configurator, fromVM Version
// and the order of executing migrations matters)
// TODO: make the order user-configurable?
sortedModNames := make([]string, 0, len(m.Modules))
hasAuth := false
const authModulename = "auth" // using authtypes.ModuleName causes import cycle.
for key := range m.Modules {
sortedModNames = append(sortedModNames, key)
if key != authModulename {
sortedModNames = append(sortedModNames, key)
} else {
hasAuth = true
}
}
sort.Strings(sortedModNames)
if hasAuth {
sortedModNames = append(sortedModNames, authModulename)
}

for _, moduleName := range sortedModNames {
module := m.Modules[moduleName]
Expand Down

0 comments on commit af06f2f

Please sign in to comment.