Add check for empty set when dropping indexes during migration (#8475)
This commit is contained in:
parent
20a28b785a
commit
80b50afe1f
1 changed files with 5 additions and 3 deletions
|
@ -384,9 +384,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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue