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

v56.go 974 B

123456789101112131415161718192021222324252627282930313233
  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. "fmt"
  7. "code.gitea.io/gitea/modules/log"
  8. "code.gitea.io/gitea/modules/setting"
  9. "github.com/go-xorm/xorm"
  10. )
  11. func removeIsOwnerColumnFromOrgUser(x *xorm.Engine) (err error) {
  12. switch {
  13. case setting.UseSQLite3:
  14. log.Warn("Unable to drop columns in SQLite")
  15. case setting.UseMySQL, setting.UseTiDB, setting.UsePostgreSQL:
  16. if _, err := x.Exec("ALTER TABLE org_user DROP COLUMN is_owner, DROP COLUMN num_teams"); err != nil {
  17. return fmt.Errorf("DROP COLUMN org_user.is_owner, org_user.num_teams: %v", err)
  18. }
  19. case setting.UseMSSQL:
  20. if _, err := x.Exec("ALTER TABLE org_user DROP COLUMN is_owner, num_teams"); err != nil {
  21. return fmt.Errorf("DROP COLUMN org_user.is_owner, org_user.num_teams: %v", err)
  22. }
  23. default:
  24. log.Fatal(4, "Unrecognized DB")
  25. }
  26. return nil
  27. }