mirror of https://github.com/go-gorm/gorm.git
Merge branch 'jsternberg-migrator-release-conn'
This commit is contained in:
commit
0b6ef3cb87
|
@ -388,8 +388,9 @@ func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnTy
|
||||||
|
|
||||||
func (m Migrator) ColumnTypes(value interface{}) (columnTypes []*sql.ColumnType, err error) {
|
func (m Migrator) ColumnTypes(value interface{}) (columnTypes []*sql.ColumnType, err error) {
|
||||||
err = m.RunWithValue(value, func(stmt *gorm.Statement) error {
|
err = m.RunWithValue(value, func(stmt *gorm.Statement) error {
|
||||||
rows, err := m.DB.Session(&gorm.Session{}).Raw("select * from ?", clause.Table{Name: stmt.Table}).Rows()
|
rows, err := m.DB.Session(&gorm.Session{}).Table(stmt.Table).Limit(1).Rows()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
defer rows.Close()
|
||||||
columnTypes, err = rows.ColumnTypes()
|
columnTypes, err = rows.ColumnTypes()
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue