mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Add protected branch whitelists for merging (#3689)
* Add database migrations for merge whitelist * Add merge whitelist settings for protected branches * Add checks for merge whitelists
This commit is contained in:
parent
04b7fd87b9
commit
9350ba7947
8 changed files with 210 additions and 42 deletions
|
@ -170,6 +170,8 @@ var migrations = []Migration{
|
|||
NewMigration("add closed_unix column for issues", addIssueClosedTime),
|
||||
// v58 -> v59
|
||||
NewMigration("add label descriptions", addLabelsDescriptions),
|
||||
// v59 -> v60
|
||||
NewMigration("add merge whitelist for protected branches", addProtectedBranchMergeWhitelist),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
24
models/migrations/v59.go
Normal file
24
models/migrations/v59.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func addProtectedBranchMergeWhitelist(x *xorm.Engine) error {
|
||||
type ProtectedBranch struct {
|
||||
EnableMergeWhitelist bool `xorm:"NOT NULL DEFAULT false"`
|
||||
MergeWhitelistUserIDs []int64 `xorm:"JSON TEXT"`
|
||||
MergeWhitelistTeamIDs []int64 `xorm:"JSON TEXT"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(ProtectedBranch)); err != nil {
|
||||
return fmt.Errorf("Sync2: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue