Commit 3508948d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add a new relation between a stage and related bridges

parent cfbcc191
...@@ -14,6 +14,7 @@ module Ci ...@@ -14,6 +14,7 @@ module Ci
has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id has_many :statuses, class_name: 'CommitStatus', foreign_key: :stage_id
has_many :builds, foreign_key: :stage_id has_many :builds, foreign_key: :stage_id
has_many :bridges, foreign_key: :stage_id
with_options unless: :importing? do with_options unless: :importing? do
validates :project, presence: true validates :project, presence: true
......
...@@ -41,7 +41,7 @@ module Gitlab ...@@ -41,7 +41,7 @@ module Gitlab
::Ci::Stage.new(attributes).tap do |stage| ::Ci::Stage.new(attributes).tap do |stage|
seeds.each do |seed| seeds.each do |seed|
if seed.bridge? if seed.bridge?
stage.statuses << seed.to_resource stage.bridges << seed.to_resource
else else
stage.builds << seed.to_resource stage.builds << seed.to_resource
end end
......
...@@ -138,6 +138,7 @@ stages: ...@@ -138,6 +138,7 @@ stages:
- pipeline - pipeline
- statuses - statuses
- builds - builds
- bridges
statuses: statuses:
- project - project
- pipeline - pipeline
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment