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.

v183.go 859B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2021 The Gitea Authors. 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. "code.gitea.io/gitea/modules/timeutil"
  9. "xorm.io/xorm"
  10. )
  11. func createPushMirrorTable(x *xorm.Engine) error {
  12. type PushMirror struct {
  13. ID int64 `xorm:"pk autoincr"`
  14. RepoID int64 `xorm:"INDEX"`
  15. RemoteName string
  16. Interval time.Duration
  17. CreatedUnix timeutil.TimeStamp `xorm:"created"`
  18. LastUpdateUnix timeutil.TimeStamp `xorm:"INDEX last_update"`
  19. LastError string `xorm:"text"`
  20. }
  21. sess := x.NewSession()
  22. defer sess.Close()
  23. if err := sess.Begin(); err != nil {
  24. return err
  25. }
  26. if err := sess.Sync2(new(PushMirror)); err != nil {
  27. return fmt.Errorf("Sync2: %v", err)
  28. }
  29. return sess.Commit()
  30. }