Commit 56681cf7 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use a separate migration to create pipeline stages index

parent 918ababb
...@@ -16,8 +16,6 @@ class MigratePipelineStages < ActiveRecord::Migration ...@@ -16,8 +16,6 @@ class MigratePipelineStages < ActiveRecord::Migration
ORDER BY stage_idx ORDER BY stage_idx
SQL SQL
add_concurrent_index(:ci_stages, [:pipeline_id, :name])
add_column(:ci_builds, :stage_id, :integer) add_column(:ci_builds, :stage_id, :integer)
stage_id = Arel.sql('(SELECT id FROM ci_stages ' \ stage_id = Arel.sql('(SELECT id FROM ci_stages ' \
...@@ -31,13 +29,5 @@ class MigratePipelineStages < ActiveRecord::Migration ...@@ -31,13 +29,5 @@ class MigratePipelineStages < ActiveRecord::Migration
def down def down
execute('TRUNCATE TABLE ci_stages') execute('TRUNCATE TABLE ci_stages')
if column_exists?(:ci_builds, :stage_id)
remove_column(:ci_builds, :stage_id)
end
if index_exists?(:ci_stages, [:pipeline_id, :name])
remove_index(:ci_stages, [:pipeline_id, :name])
end
end end
end end
class CreateIndexInPipelineStages < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:ci_stages, [:pipeline_id, :name])
end
def down
remove_index(:ci_stages, [:pipeline_id, :name])
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