1.3.0: go: add return check
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
fa9f3c490f
commit
3de726658f
1 changed files with 6 additions and 2 deletions
|
|
@ -15,7 +15,9 @@ func DropUnusedColumns(DB *gorm.DB, values ...interface{}) {
|
|||
|
||||
for _, dst := range values {
|
||||
stmt := &gorm.Statement{DB: DB}
|
||||
stmt.Parse(dst)
|
||||
if stmt.Parse(dst) != nil {
|
||||
return
|
||||
}
|
||||
fields := stmt.Schema.Fields
|
||||
columns, _ := DB.Debug().Migrator().ColumnTypes(dst)
|
||||
|
||||
|
|
@ -28,7 +30,9 @@ func DropUnusedColumns(DB *gorm.DB, values ...interface{}) {
|
|||
}
|
||||
}
|
||||
if !found {
|
||||
DB.Migrator().DropColumn(dst, columns[i].Name())
|
||||
if DB.Migrator().DropColumn(dst, columns[i].Name()) != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue