summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2020-01-03 18:47:10 +0100
committerLauris BH <lauris@nix.lv>2020-01-03 19:47:09 +0200
commitea707f5a77d83d023cb02ce8e44c4b95ac83ef30 (patch)
treefdebe0cc3d2b0e41cf8c7932ae446a2e3c500bbc /models/migrations
parentb39fab41c8b315ba7ddf9f9a4cc522385cf9f720 (diff)
downloadgitea-ea707f5a77d83d023cb02ce8e44c4b95ac83ef30.tar.gz
gitea-ea707f5a77d83d023cb02ce8e44c4b95ac83ef30.zip
Add branch protection option to block merge on requested changes. (#9592)
* Add branch protection option to block merge on requested changes. * Add migration step * Fix check to correct negation * Apply suggestions from code review Language improvement. Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com> * Copyright year. Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v117.go17
2 files changed, 19 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index e8bb3f16d4..73c9bc1138 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -288,6 +288,8 @@ var migrations = []Migration{
NewMigration("add user_id prefix to existing user avatar name", renameExistingUserAvatarName),
// v116 -> v117
NewMigration("Extend TrackedTimes", extendTrackedTimes),
+ // v117 -> v118
+ NewMigration("Add block on rejected reviews branch protection", addBlockOnRejectedReviews),
}
// Migrate database to current version
diff --git a/models/migrations/v117.go b/models/migrations/v117.go
new file mode 100644
index 0000000000..662d6c7b46
--- /dev/null
+++ b/models/migrations/v117.go
@@ -0,0 +1,17 @@
+// 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 addBlockOnRejectedReviews(x *xorm.Engine) error {
+ type ProtectedBranch struct {
+ BlockOnRejectedReviews bool `xorm:"NOT NULL DEFAULT false"`
+ }
+
+ return x.Sync2(new(ProtectedBranch))
+}