Set the logging level to info during automigrate
This commit is contained in:
parent
02c2e53c51
commit
d81a06308a
1 changed files with 6 additions and 0 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"git.mstar.dev/mstar/goutils/other"
|
||||
"git.mstar.dev/mstar/goutils/sliceutils"
|
||||
"github.com/rs/zerolog"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/models"
|
||||
|
@ -13,6 +14,11 @@ import (
|
|||
|
||||
// Auto-migrate all tables and types used
|
||||
func Migrate(db *gorm.DB) error {
|
||||
// Shut up gorm's queries during automigrate by setting log level to info during migration
|
||||
// and then back to the previous value on exit
|
||||
currentLogLevel := zerolog.GlobalLevel()
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
defer zerolog.SetGlobalLevel(currentLogLevel)
|
||||
if err := createAccountAuthMethodType(db); err != nil {
|
||||
return other.Error("storage", "Failed to create Auth Method type", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue