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