You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
555 B

  1. // Copyright 2017 Gitea. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package migrations
  5. import (
  6. "github.com/go-xorm/xorm"
  7. )
  8. // Team see models/team.go
  9. type Team struct {
  10. UnitTypes []int `xorm:"json"`
  11. }
  12. const ownerAccessMode = 4
  13. var allUnitTypes = []int{1, 2, 3, 4, 5, 6, 7, 8, 9}
  14. func giveAllUnitsToOwnerTeams(x *xorm.Engine) error {
  15. _, err := x.Cols("unit_types").
  16. Where("authorize = ?", ownerAccessMode).
  17. Update(&Team{UnitTypes: allUnitTypes})
  18. return err
  19. }