mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-20 05:07:16 +02:00
Add units to team (#947)
* add units to team * fix lint * finish team setting backend * finished permission controll on routes * fix import blank line * add unit check on ssh/http pull and push and fix test failed * fix fixtures data * remove unused code
This commit is contained in:
@ -112,6 +112,8 @@ var migrations = []Migration{
|
||||
NewMigration("add primary key to external login user", addExternalLoginUserPK),
|
||||
// 31 -> 32
|
||||
NewMigration("add field for login source synchronization", addLoginSourceSyncEnabledColumn),
|
||||
// v32 -> v33
|
||||
NewMigration("add units for team", addUnitsToRepoTeam),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2017 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2017 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.
|
||||
|
||||
|
23
models/migrations/v32.go
Normal file
23
models/migrations/v32.go
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2017 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 addUnitsToRepoTeam(x *xorm.Engine) error {
|
||||
type Team struct {
|
||||
UnitTypes []int `xorm:"json"`
|
||||
}
|
||||
|
||||
err := x.Sync(new(Team))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = x.Update(&Team{
|
||||
UnitTypes: []int{1, 2, 3, 4, 5, 6, 7, 8, 9},
|
||||
})
|
||||
return err
|
||||
}
|
Reference in New Issue
Block a user