mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Reorder migrations, skip errors if running migration again (#3160)
* Reorder migrations, skip errors if running migration again * Rename migration file names to match migration version * Add note about ingored error
This commit is contained in:
@@ -5,10 +5,9 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
@@ -18,7 +17,8 @@ func removeIndexColumnFromRepoUnitTable(x *xorm.Engine) (err error) {
|
||||
log.Warn("Unable to drop columns in SQLite")
|
||||
case setting.UseMySQL, setting.UsePostgreSQL, setting.UseMSSQL, setting.UseTiDB:
|
||||
if _, err := x.Exec("ALTER TABLE repo_unit DROP COLUMN `index`"); err != nil {
|
||||
return fmt.Errorf("DROP COLUMN index: %v", err)
|
||||
// Ignoring this error in case we run this migration second time (after migration reordering)
|
||||
log.Warn("DROP COLUMN index: %v", err)
|
||||
}
|
||||
default:
|
||||
log.Fatal(4, "Unrecognized DB")
|
||||
|
Reference in New Issue
Block a user