chore(model): create build, stage, step and logs table

Signed-off-by: Bo-Yi.Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi.Wu
2022-09-01 11:03:50 +08:00
committed by Jason Song
parent e05f224d19
commit e07d416366
7 changed files with 66 additions and 31 deletions

View File

@ -13,11 +13,10 @@ import (
// BuildLog represents a build's log, every build has a standalone table
type BuildLog struct {
ID int64
BuildJobID int64 `xorm:"index"`
LineNumber int
Content string `xorm:"LONGTEXT"`
Created timeutil.TimeStamp `xorm:"created"`
ID int64
StepID int64 `xorm:"index"`
Content string `xorm:"BINARY"`
Created timeutil.TimeStamp `xorm:"created"`
}
func init() {
@ -37,7 +36,7 @@ func CreateBuildLog(buildID int64) error {
func GetBuildLogs(buildID, jobID int64) (logs []BuildLog, err error) {
err = db.GetEngine(db.DefaultContext).Table(GetBuildLogTableName(buildID)).
Where("build_job_id=?", jobID).
Where("build_step_id=?", jobID).
Find(&logs)
return
}