Add a reference to parent build on forks / deploys

This commit is contained in:
Vaidas Jablonskis 2016-10-18 16:45:15 +01:00
parent 2d90155d5a
commit 284fca370e
5 changed files with 23 additions and 0 deletions

View file

@ -5,6 +5,7 @@ type Build struct {
ID int64 `json:"id" meddler:"build_id,pk"`
RepoID int64 `json:"-" meddler:"build_repo_id"`
Number int `json:"number" meddler:"build_number"`
Parent int `json:"parent" meddler:"build_parent"`
Event string `json:"event" meddler:"build_event"`
Status string `json:"status" meddler:"build_status"`
Enqueued int64 `json:"enqueued_at" meddler:"build_enqueued"`

View file

@ -228,6 +228,7 @@ func PostBuild(c *gin.Context) {
if forkit, _ := strconv.ParseBool(fork); forkit {
build.ID = 0
build.Number = 0
build.Parent = num
for _, job := range jobs {
job.ID = 0
job.NodeID = 0

View file

@ -0,0 +1,7 @@
-- +migrate Up
ALTER TABLE builds ADD COLUMN build_parent INTEGER DEFAULT 0;
-- +migrate Down
ALTER TABLE builds DROP COLUMN build_parent;

View file

@ -0,0 +1,7 @@
-- +migrate Up
ALTER TABLE builds ADD COLUMN build_parent INTEGER DEFAULT 0;
-- +migrate Down
ALTER TABLE builds DROP COLUMN build_parent;

View file

@ -0,0 +1,7 @@
-- +migrate Up
ALTER TABLE builds ADD COLUMN build_parent INTEGER DEFAULT 0;
-- +migrate Down
ALTER TABLE builds DROP COLUMN build_parent;