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.

29 lines
681 B

  1. // Copyright 2016 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. "fmt"
  7. "time"
  8. "xorm.io/xorm"
  9. )
  10. func setProtectedBranchUpdatedWithCreated(x *xorm.Engine) (err error) {
  11. type ProtectedBranch struct {
  12. ID int64 `xorm:"pk autoincr"`
  13. RepoID int64 `xorm:"UNIQUE(s)"`
  14. BranchName string `xorm:"UNIQUE(s)"`
  15. CanPush bool
  16. Created time.Time `xorm:"-"`
  17. CreatedUnix int64
  18. Updated time.Time `xorm:"-"`
  19. UpdatedUnix int64
  20. }
  21. if err = x.Sync2(new(ProtectedBranch)); err != nil {
  22. return fmt.Errorf("Sync2: %v", err)
  23. }
  24. return nil
  25. }