mirror of https://github.com/go-gorm/gorm.git
fix missing error-check in AutoMigrate (#5283)
This commit is contained in:
parent
88c26b62ee
commit
395606ac7c
|
@ -99,7 +99,10 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := m.RunWithValue(value, func(stmt *gorm.Statement) (errr error) {
|
if err := m.RunWithValue(value, func(stmt *gorm.Statement) (errr error) {
|
||||||
columnTypes, _ := m.DB.Migrator().ColumnTypes(value)
|
columnTypes, err := m.DB.Migrator().ColumnTypes(value)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for _, dbName := range stmt.Schema.DBNames {
|
for _, dbName := range stmt.Schema.DBNames {
|
||||||
field := stmt.Schema.FieldsByDBName[dbName]
|
field := stmt.Schema.FieldsByDBName[dbName]
|
||||||
|
|
Loading…
Reference in New Issue