Commit 090ed087 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Bump build stage id reference migration identifier

parent 885d63d9
...@@ -3,25 +3,17 @@ class MigrateBuildStageReference < ActiveRecord::Migration ...@@ -3,25 +3,17 @@ class MigrateBuildStageReference < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
disable_ddl_transaction! ##
# This is an empty migration, content has been moved to a new one:
# post migrate 20170526190000 MigrateBuildStageReferenceAgain
#
# See gitlab-org/gitlab-ce!12337 for more details.
def up def up
disable_statement_timeout # noop
stage_id = Arel.sql <<-SQL.strip_heredoc
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
SQL
update_column_in_batches(:ci_builds, :stage_id, stage_id) do |table, query|
query.where(table[:stage_id].eq(nil))
end
end end
def down def down
disable_statement_timeout # noop
update_column_in_batches(:ci_builds, :stage_id, nil)
end end
end end
class MigrateBuildStageReferenceAgain < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
disable_statement_timeout
stage_id = Arel.sql <<-SQL.strip_heredoc
(SELECT id FROM ci_stages
WHERE ci_stages.pipeline_id = ci_builds.commit_id
AND ci_stages.name = ci_builds.stage)
SQL
update_column_in_batches(:ci_builds, :stage_id, stage_id) do |table, query|
query.where(table[:stage_id].eq(nil))
end
end
def down
disable_statement_timeout
update_column_in_batches(:ci_builds, :stage_id, nil)
end
end
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