gitea源码

12345678910111213141516171819202122
  1. // Copyright 2024 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_22
  4. import "xorm.io/xorm"
  5. func AddDefaultWikiBranch(x *xorm.Engine) error {
  6. type Repository struct {
  7. ID int64
  8. DefaultWikiBranch string
  9. }
  10. if _, err := x.SyncWithOptions(xorm.SyncOptions{
  11. IgnoreIndices: true,
  12. IgnoreConstrains: true,
  13. }, &Repository{}); err != nil {
  14. return err
  15. }
  16. _, err := x.Exec("UPDATE `repository` SET default_wiki_branch = 'master' WHERE (default_wiki_branch IS NULL) OR (default_wiki_branch = '')")
  17. return err
  18. }