diff options
author | Chri-s <Chri-s@users.noreply.github.com> | 2018-03-25 12:01:32 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-03-25 13:01:32 +0300 |
commit | 9350ba7947d8caa6e7338d7c9e54df2f3aef2146 (patch) | |
tree | e40e1f9810c03221073742040c7fc2c93b3b7546 /models/migrations/v59.go | |
parent | 04b7fd87b9d74aa6a0c559ac218546978bbf6f33 (diff) | |
download | gitea-9350ba7947d8caa6e7338d7c9e54df2f3aef2146.tar.gz gitea-9350ba7947d8caa6e7338d7c9e54df2f3aef2146.zip |
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
Diffstat (limited to 'models/migrations/v59.go')
-rw-r--r-- | models/migrations/v59.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/models/migrations/v59.go b/models/migrations/v59.go new file mode 100644 index 0000000000..0a05495e76 --- /dev/null +++ b/models/migrations/v59.go @@ -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 +} |