summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-06-20 16:58:54 +0000
committerRémy Coutable <remy@rymai.me>2016-06-20 16:58:54 +0000
commitd32ac35642aa0d75ecf5fafd7cb3e3665bbe2581 (patch)
tree4b4e45b7ebb8709bb21d08739cf20c57e6c45b31
parent032e398374b40d5b68c4a1ce89dd698f1d03a54c (diff)
parentbcecc1957120ed1e24b617d554637cd7da60d0cc (diff)
downloadgitlab-ce-d32ac35642aa0d75ecf5fafd7cb3e3665bbe2581.tar.gz
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
-rw-r--r--db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
new file mode 100644
index 00000000000..bd0463886bc
--- /dev/null
+++ b/db/migrate/20160615191922_set_missing_stage_on_ci_builds.rb
@@ -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