code.gitea.io/gitea@v1.21.7/models/migrations/v1_12/v118.go (about)

     1  // Copyright 2019 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_12 //nolint
     5  
     6  import (
     7  	"xorm.io/xorm"
     8  )
     9  
    10  func AddReviewCommitAndStale(x *xorm.Engine) error {
    11  	type Review struct {
    12  		CommitID string `xorm:"VARCHAR(40)"`
    13  		Stale    bool   `xorm:"NOT NULL DEFAULT false"`
    14  	}
    15  
    16  	type ProtectedBranch struct {
    17  		DismissStaleApprovals bool `xorm:"NOT NULL DEFAULT false"`
    18  	}
    19  
    20  	// Old reviews will have commit ID set to "" and not stale
    21  	if err := x.Sync(new(Review)); err != nil {
    22  		return err
    23  	}
    24  	return x.Sync(new(ProtectedBranch))
    25  }