diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/branches.go | 1 | ||||
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v103.go | 18 | ||||
-rw-r--r-- | models/update.go | 2 |
4 files changed, 23 insertions, 0 deletions
diff --git a/models/branches.go b/models/branches.go index fa8beb866c..c5f227f1e5 100644 --- a/models/branches.go +++ b/models/branches.go @@ -34,6 +34,7 @@ type ProtectedBranch struct { WhitelistUserIDs []int64 `xorm:"JSON TEXT"` WhitelistTeamIDs []int64 `xorm:"JSON TEXT"` EnableMergeWhitelist bool `xorm:"NOT NULL DEFAULT false"` + WhitelistDeployKeys bool `xorm:"NOT NULL DEFAULT false"` MergeWhitelistUserIDs []int64 `xorm:"JSON TEXT"` MergeWhitelistTeamIDs []int64 `xorm:"JSON TEXT"` EnableStatusCheck bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 8064eccfc1..8b1329ea68 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -260,6 +260,8 @@ var migrations = []Migration{ NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser), // v102 -> v103 NewMigration("update migration repositories' service type", dropColumnHeadUserNameOnPullRequest), + // v103 -> v104 + NewMigration("Add WhitelistDeployKeys to protected branch", addWhitelistDeployKeysToBranches), } // Migrate database to current version diff --git a/models/migrations/v103.go b/models/migrations/v103.go new file mode 100644 index 0000000000..fed025c5cd --- /dev/null +++ b/models/migrations/v103.go @@ -0,0 +1,18 @@ +// Copyright 2019 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 addWhitelistDeployKeysToBranches(x *xorm.Engine) error { + type ProtectedBranch struct { + ID int64 + WhitelistDeployKeys bool `xorm:"NOT NULL DEFAULT false"` + } + + return x.Sync2(new(ProtectedBranch)) +} diff --git a/models/update.go b/models/update.go index c6ea1a845e..5e941c22c4 100644 --- a/models/update.go +++ b/models/update.go @@ -22,6 +22,8 @@ const ( EnvPusherName = "GITEA_PUSHER_NAME" EnvPusherEmail = "GITEA_PUSHER_EMAIL" EnvPusherID = "GITEA_PUSHER_ID" + EnvKeyID = "GITEA_KEY_ID" + EnvIsDeployKey = "GITEA_IS_DEPLOY_KEY" ) // CommitToPushCommit transforms a git.Commit to PushCommit type. |