Merge branch '17949-error-500-on-gitlab-org-when-visiting-pipelines' into 'master'

Set missing stages on ci builds to 'test' to avoid regressions in the pipelines view

## What does this MR do?

Sets a default stage on old `ci_builds`.

## Are there points in the code the reviewer needs to double check?

Is the migration acceptable for online execution?

## Why was this MR needed?

Old `ci_builds`with no stages cause a regression on the pipelines index view.

## What are the relevant issue numbers?

#17949 

Blocked by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4680


See merge request !4381
This commit is contained in:
Rémy Coutable 2016-06-20 16:58:54 +00:00
commit d32ac35642

View file

@ -0,0 +1,9 @@
class SetMissingStageOnCiBuilds < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
def up
update_column_in_batches(:ci_builds, :stage, :test) do |table, query|
query.where(table[:stage].eq(nil))
end
end
end