diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 14:30:44 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-05-01 14:30:44 +0200 |
commit | 0fd0b64be63c18bb216f15d887e3ce0955dcf269 (patch) | |
tree | f62cd1d970ba738ef0825f745c4c44714a6b126e /app | |
parent | b337a086d5118e80518945abfc2e88008d9fc1ec (diff) | |
download | gitlab-ce-0fd0b64be63c18bb216f15d887e3ce0955dcf269.tar.gz |
Use stages position column to track stage index
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/stage.rb | 6 | ||||
-rw-r--r-- | app/services/ci/ensure_stage_service.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index 9a913213bb9..5a1eeb966aa 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -17,7 +17,7 @@ module Ci validates :project, presence: true validates :pipeline, presence: true validates :name, presence: true - validates :priority, presence: true + validates :position, presence: true end after_initialize do @@ -25,9 +25,9 @@ module Ci end before_validation unless: :importing? do - next if priority.present? + next if position.present? - self.priority = statuses.select(:stage_idx) + self.position = statuses.select(:stage_idx) .where('stage_idx IS NOT NULL') .group(:stage_idx) .order('COUNT(*) DESC') diff --git a/app/services/ci/ensure_stage_service.rb b/app/services/ci/ensure_stage_service.rb index e3e3e2d03c1..b8c7be2d350 100644 --- a/app/services/ci/ensure_stage_service.rb +++ b/app/services/ci/ensure_stage_service.rb @@ -42,7 +42,7 @@ module Ci def create_stage Ci::Stage.create!(name: @build.stage, - priority: @build.stage_idx, + position: @build.stage_idx, pipeline: @build.pipeline, project: @build.project) end |