You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

v45.go 823B

12345678910111213141516171819202122232425262728
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package migrations
  5. import (
  6. "code.gitea.io/gitea/modules/log"
  7. "code.gitea.io/gitea/modules/setting"
  8. "xorm.io/xorm"
  9. )
  10. func removeIndexColumnFromRepoUnitTable(x *xorm.Engine) (err error) {
  11. switch {
  12. case setting.Database.UseSQLite3:
  13. log.Warn("Unable to drop columns in SQLite")
  14. case setting.Database.UseMySQL, setting.Database.UsePostgreSQL, setting.Database.UseMSSQL:
  15. if _, err := x.Exec("ALTER TABLE repo_unit DROP COLUMN `index`"); err != nil {
  16. // Ignoring this error in case we run this migration second time (after migration reordering)
  17. log.Warn("DROP COLUMN index: %v", err)
  18. }
  19. default:
  20. log.Fatal("Unrecognized DB")
  21. }
  22. return nil
  23. }