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.

24 lines
601 B

  1. // Copyright 2020 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/log"
  7. "xorm.io/builder"
  8. "xorm.io/xorm"
  9. )
  10. func setIsArchivedToFalse(x *xorm.Engine) error {
  11. type Repository struct {
  12. IsArchived bool `xorm:"INDEX"`
  13. }
  14. count, err := x.Where(builder.IsNull{"is_archived"}).Cols("is_archived").Update(&Repository{
  15. IsArchived: false,
  16. })
  17. if err == nil {
  18. log.Debug("Updated %d repositories with is_archived IS NULL", count)
  19. }
  20. return err
  21. }