mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 05:12:47 +01:00
Add check for empty set when dropping indexes during migration (#8471)
* Add check for empty set when dropping indexes during migration
This commit is contained in:
parent
5e759b60cc
commit
f1fdd782d5
1 changed files with 5 additions and 3 deletions
|
@ -404,9 +404,11 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
|
|||
}
|
||||
for _, index := range res {
|
||||
indexName := index["column_name"]
|
||||
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
|
||||
if err != nil {
|
||||
return err
|
||||
if len(indexName) > 0 {
|
||||
_, err := sess.Exec(fmt.Sprintf("DROP INDEX `%s` ON `%s`", indexName, tableName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue