code.gitea.io/gitea@v1.21.7/models/migrations/v1_13/v142.go (about)

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