From 395606ac7ce6c1fcd9bd9c79c16b73cb1bc13bc8 Mon Sep 17 00:00:00 2001 From: glebarez <47985861+glebarez@users.noreply.github.com> Date: Fri, 22 Apr 2022 06:19:33 +0300 Subject: [PATCH] fix missing error-check in AutoMigrate (#5283) --- migrator/migrator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migrator/migrator.go b/migrator/migrator.go index a50bb3ff..93f4c5d0 100644 --- a/migrator/migrator.go +++ b/migrator/migrator.go @@ -99,7 +99,10 @@ func (m Migrator) AutoMigrate(values ...interface{}) error { } } else { 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 { field := stmt.Schema.FieldsByDBName[dbName]