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

pull/8484/head
guillep2k 5 years ago committed by zeripath
parent 20a28b785a
commit 80b50afe1f
  1. 2
      models/migrations/migrations.go

@ -384,11 +384,13 @@ 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"]
if len(indexName) > 0 {
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName)) _, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
if err != nil { if err != nil {
return err return err
} }
} }
}
// Now drop the columns // Now drop the columns
cols := "" cols := ""

Loading…
Cancel
Save