Skip to content

Commit 59758cc

Browse files
committed
perf: modify log level for query field comment to avoid printing excessive useless logs
1 parent e4296ac commit 59758cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

migrator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"gorm.io/gorm"
1010
"gorm.io/gorm/clause"
11+
"gorm.io/gorm/logger"
1112
"gorm.io/gorm/migrator"
1213
"gorm.io/gorm/schema"
1314
)
@@ -273,9 +274,8 @@ func (m Migrator) RenameColumn(value interface{}, oldName, newName string) error
273274
}
274275

275276
func (m Migrator) GetColumnComment(stmt *gorm.Statement, fieldDBName string) (description string) {
276-
queryTx := m.DB
277+
queryTx := m.DB.Session(&gorm.Session{Logger: m.DB.Logger.LogMode(logger.Warn)})
277278
if m.DB.DryRun {
278-
queryTx = m.DB.Session(&gorm.Session{})
279279
queryTx.DryRun = false
280280
}
281281
var comment sql.NullString

0 commit comments

Comments
 (0)