summaryrefslogtreecommitdiffstats
path: root/models/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v55.go23
2 files changed, 25 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 90f286056f..37f3717ff4 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -162,6 +162,8 @@ var migrations = []Migration{
NewMigration("add reactions", addReactions),
// v54 -> v55
NewMigration("add pull request options", addPullRequestOptions),
+ // v55 -> v56
+ NewMigration("add writable deploy keys", addModeToDeploKeys),
}
// Migrate database to current version
diff --git a/models/migrations/v55.go b/models/migrations/v55.go
new file mode 100644
index 0000000000..32f4e8ac04
--- /dev/null
+++ b/models/migrations/v55.go
@@ -0,0 +1,23 @@
+// 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"
+
+ "code.gitea.io/gitea/models"
+ "github.com/go-xorm/xorm"
+)
+
+func addModeToDeploKeys(x *xorm.Engine) error {
+ type DeployKey struct {
+ Mode models.AccessMode `xorm:"NOT NULL DEFAULT 1"`
+ }
+
+ if err := x.Sync2(new(DeployKey)); err != nil {
+ return fmt.Errorf("Sync2: %v", err)
+ }
+ return nil
+}