Skip to content

Commit

Permalink
perf: modify log level for query field comment to avoid printing exce…
Browse files Browse the repository at this point in the history
…ssive useless logs
  • Loading branch information
iTanken committed Dec 19, 2024
1 parent e4296ac commit 59758cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"gorm.io/gorm"
"gorm.io/gorm/clause"
"gorm.io/gorm/logger"
"gorm.io/gorm/migrator"
"gorm.io/gorm/schema"
)
Expand Down Expand Up @@ -273,9 +274,8 @@ func (m Migrator) RenameColumn(value interface{}, oldName, newName string) error
}

func (m Migrator) GetColumnComment(stmt *gorm.Statement, fieldDBName string) (description string) {
queryTx := m.DB
queryTx := m.DB.Session(&gorm.Session{Logger: m.DB.Logger.LogMode(logger.Warn)})
if m.DB.DryRun {
queryTx = m.DB.Session(&gorm.Session{})
queryTx.DryRun = false
}
var comment sql.NullString
Expand Down

0 comments on commit 59758cc

Please sign in to comment.