From c1b0df2fd1723fca4413ea3846a440fd0ba65de2 Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Fri, 11 Oct 2019 19:35:46 -0300 Subject: [PATCH 1/2] Add check for empty set when dropping indexes during migration --- models/migrations/migrations.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 1f5b918de854..e14437a04b35 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -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 + } } } From 56d058d854d32ffcad27a07c95e2f9937f9bce6f Mon Sep 17 00:00:00 2001 From: Guillermo Prandi Date: Fri, 11 Oct 2019 20:54:22 -0300 Subject: [PATCH 2/2] Restart CI