diff options
author | Vlad Temian <vladtemian@gmail.com> | 2018-01-07 00:55:53 +0200 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2018-01-07 00:55:53 +0200 |
commit | e78786ef39526fac6705a831fc291c55f1ca091b (patch) | |
tree | c529a79c1460facdf30f04b860cee234d64c229c /models/migrations/v55.go | |
parent | 70b6c07590f9014876073e2d69a6278e94db582f (diff) | |
download | gitea-e78786ef39526fac6705a831fc291c55f1ca091b.tar.gz gitea-e78786ef39526fac6705a831fc291c55f1ca091b.zip |
Writable deploy keys (closes #671) (#3225)
* Add is_writable checkbox to deploy keys interface
* Add writable key option to deploy key form
* Add support for writable ssh keys in the interface
* Rename IsWritable to ReadOnly
* Test: create read-only and read-write deploy keys via api
* Add DeployKey access mode migration
* Update gitea sdk via govendor
* Fix deploykey migration
* Add unittests for writable deploy keys
* Move template text to locale
* Remove implicit column update
* Remove duplicate locales
* Replace ReadOnly field with IsReadOnly method
* Fix deploy_keys related integration test
* Rename v54 migration with v55
* Fix migration hell
Diffstat (limited to 'models/migrations/v55.go')
-rw-r--r-- | models/migrations/v55.go | 23 |
1 files changed, 23 insertions, 0 deletions
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 +} |