From d1e17d549fc3fb9a66e150d425e090dca838ab07 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 1 Sep 2020 20:52:06 +0800 Subject: [PATCH] request ColumnTypes after new session method --- migrator/migrator.go | 2 +- tests/go.mod | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/migrator/migrator.go b/migrator/migrator.go index 1aebc50d..29d26c9e 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -388,7 +388,7 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy func (m Migrator) ColumnTypes(value interface{}) (columnTypes []*sql.ColumnType, err error) { err = m.RunWithValue(value, func(stmt *gorm.Statement) error { - rows, err := m.DB.Raw("select * from ?", clause.Table{Name: stmt.Table}).Rows() + rows, err := m.DB.Session(&gorm.Session{}).Raw("select * from ?", clause.Table{Name: stmt.Table}).Rows() if err == nil { columnTypes, err = rows.ColumnTypes() } diff --git a/tests/go.mod b/tests/go.mod index f3dd6dbc..30a7dda7 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -6,10 +6,10 @@ require ( github.com/google/uuid v1.1.1 github.com/jinzhu/now v1.1.1 github.com/lib/pq v1.6.0 - gorm.io/driver/mysql v1.0.0 + gorm.io/driver/mysql v1.0.1 gorm.io/driver/postgres v1.0.0 - gorm.io/driver/sqlite v1.1.0 - gorm.io/driver/sqlserver v1.0.1 + gorm.io/driver/sqlite v1.1.1 + gorm.io/driver/sqlserver v1.0.2 gorm.io/gorm v1.9.19 )