Add check for empty set when dropping indexes during migration (#8471)

* Add check for empty set when dropping indexes during migration
tokarchuk/v1.17
guillep2k 5 years ago committed by zeripath
parent 5e759b60cc
commit f1fdd782d5
  1. 8
      models/migrations/migrations.go

@ -404,9 +404,11 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
} }
for _, index := range res { for _, index := range res {
indexName := index["column_name"] indexName := index["column_name"]
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName)) if len(indexName) > 0 {
if err != nil { _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
return err if err != nil {
return err
}
} }
} }

Loading…
Cancel
Save