gitea源码

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package v1_10
  4. import (
  5. "code.gitea.io/gitea/modules/timeutil"
  6. "xorm.io/xorm"
  7. )
  8. func AddTaskTable(x *xorm.Engine) error {
  9. // TaskType defines task type
  10. type TaskType int
  11. // TaskStatus defines task status
  12. type TaskStatus int
  13. type Task struct {
  14. ID int64
  15. DoerID int64 `xorm:"index"` // operator
  16. OwnerID int64 `xorm:"index"` // repo owner id, when creating, the repoID maybe zero
  17. RepoID int64 `xorm:"index"`
  18. Type TaskType
  19. Status TaskStatus `xorm:"index"`
  20. StartTime timeutil.TimeStamp
  21. EndTime timeutil.TimeStamp
  22. PayloadContent string `xorm:"TEXT"`
  23. Errors string `xorm:"TEXT"` // if task failed, saved the error reason
  24. Created timeutil.TimeStamp `xorm:"created"`
  25. }
  26. type Repository struct {
  27. Status int `xorm:"NOT NULL DEFAULT 0"`
  28. }
  29. return x.Sync(new(Task), new(Repository))
  30. }