gitea源码

12345678910111213141516171819202122232425
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_13
  4. import (
  5. "code.gitea.io/gitea/modules/log"
  6. "xorm.io/builder"
  7. "xorm.io/xorm"
  8. )
  9. func SetIsArchivedToFalse(x *xorm.Engine) error {
  10. type Repository struct {
  11. IsArchived bool `xorm:"INDEX"`
  12. }
  13. count, err := x.Where(builder.IsNull{"is_archived"}).Cols("is_archived").Update(&Repository{
  14. IsArchived: false,
  15. })
  16. if err == nil {
  17. log.Debug("Updated %d repositories with is_archived IS NULL", count)
  18. }
  19. return err
  20. }