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.

v139.go 682B

12345678910111213141516171819202122232425
  1. // Copyright 2019 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/setting"
  7. "xorm.io/xorm"
  8. )
  9. func prependRefsHeadsToIssueRefs(x *xorm.Engine) error {
  10. var query string
  11. switch {
  12. case setting.Database.UseMSSQL:
  13. query = "UPDATE `issue` SET `ref` = 'refs/heads/' + `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'"
  14. default:
  15. query = "UPDATE `issue` SET `ref` = 'refs/heads/' || `ref` WHERE `ref` IS NOT NULL AND `ref` <> '' AND `ref` NOT LIKE 'refs/%'"
  16. }
  17. _, err := x.Exec(query)
  18. return err
  19. }