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.

v33.go 1012B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2017 Gitea. 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. "fmt"
  7. "code.gitea.io/gitea/modules/log"
  8. "code.gitea.io/gitea/modules/setting"
  9. "xorm.io/xorm"
  10. )
  11. func removeActionColumns(x *xorm.Engine) error {
  12. switch {
  13. case setting.Database.UseSQLite3:
  14. log.Warn("Unable to drop columns in SQLite")
  15. case setting.Database.UseMySQL, setting.Database.UsePostgreSQL, setting.Database.UseMSSQL:
  16. if _, err := x.Exec("ALTER TABLE action DROP COLUMN act_user_name"); err != nil {
  17. return fmt.Errorf("DROP COLUMN act_user_name: %v", err)
  18. } else if _, err = x.Exec("ALTER TABLE action DROP COLUMN repo_user_name"); err != nil {
  19. return fmt.Errorf("DROP COLUMN repo_user_name: %v", err)
  20. } else if _, err = x.Exec("ALTER TABLE action DROP COLUMN repo_name"); err != nil {
  21. return fmt.Errorf("DROP COLUMN repo_name: %v", err)
  22. }
  23. default:
  24. log.Fatal("Unrecognized DB")
  25. }
  26. return nil
  27. }