code.gitea.io/gitea@v1.21.7/models/migrations/v1_10/v94.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_10 //nolint
     5  
     6  import "xorm.io/xorm"
     7  
     8  func AddStatusCheckColumnsForProtectedBranches(x *xorm.Engine) error {
     9  	type ProtectedBranch struct {
    10  		EnableStatusCheck   bool     `xorm:"NOT NULL DEFAULT false"`
    11  		StatusCheckContexts []string `xorm:"JSON TEXT"`
    12  	}
    13  
    14  	if err := x.Sync(new(ProtectedBranch)); err != nil {
    15  		return err
    16  	}
    17  
    18  	_, err := x.Cols("enable_status_check", "status_check_contexts").Update(&ProtectedBranch{
    19  		EnableStatusCheck:   false,
    20  		StatusCheckContexts: []string{},
    21  	})
    22  	return err
    23  }