Merge pull request #1823 from vaijab/parent_number

Add a reference to a parent build on forks / deploys
This commit is contained in:
Brad Rydzewski 2016-10-20 01:41:42 +02:00 committed by GitHub
commit a52028a4e1
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;