mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Prevent merge of outdated PRs on protected branches (#11012)
* Block PR on Outdated Branch * finalize * cleanup * fix typo and sentences thanks @guillep2k Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
2cb5878529
commit
c52d48aae4
15 changed files with 81 additions and 5 deletions
|
@ -202,10 +202,12 @@ var migrations = []Migration{
|
|||
NewMigration("Add EmailHash Table", addEmailHashTable),
|
||||
// v134 -> v135
|
||||
NewMigration("Refix merge base for merged pull requests", refixMergeBase),
|
||||
// v135 -> 136
|
||||
// v135 -> v136
|
||||
NewMigration("Add OrgID column to Labels table", addOrgIDLabelColumn),
|
||||
// v136 -> 137
|
||||
// v136 -> v137
|
||||
NewMigration("Add CommitsAhead and CommitsBehind Column to PullRequest Table", addCommitDivergenceToPulls),
|
||||
// v137 -> v138
|
||||
NewMigration("Add Branch Protection Block Outdated Branch", addBlockOnOutdatedBranch),
|
||||
}
|
||||
|
||||
// GetCurrentDBVersion returns the current db version
|
||||
|
|
16
models/migrations/v137.go
Normal file
16
models/migrations/v137.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2020 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 (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addBlockOnOutdatedBranch(x *xorm.Engine) error {
|
||||
type ProtectedBranch struct {
|
||||
BlockOnOutdatedBranch bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
return x.Sync2(new(ProtectedBranch))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue