Add field IsAllRepositories to team
This commit is contained in:
@@ -223,6 +223,8 @@ var migrations = []Migration{
|
||||
NewMigration("add uploader id for table attachment", addUploaderIDForAttachment),
|
||||
// v84 -> v85
|
||||
NewMigration("add table to store original imported gpg keys", addGPGKeyImport),
|
||||
// v85 -> v86
|
||||
NewMigration("add is_all_repositories to teams", addTeamIsAllRepositories),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
||||
25
models/migrations/v85.go
Normal file
25
models/migrations/v85.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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 (
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func addTeamIsAllRepositories(x *xorm.Engine) error {
|
||||
|
||||
type Team struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
IsAllRepositories bool `xorm:"NOT NULL DEFAULT false"`
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(Team)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err := x.Exec("UPDATE team SET is_all_repositories = ? WHERE name=?",
|
||||
true, "Owners")
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user