Create index on id instead of stage_id in migration

This commit is contained in:
Grzegorz Bizon 2018-02-21 09:27:07 +01:00
parent 2f3f9a6bb0
commit e79784b79a
2 changed files with 6 additions and 6 deletions

View file

@ -4,11 +4,11 @@ class AddTmpPartialNullIndexToBuilds < ActiveRecord::Migration
disable_ddl_transaction!
def up
add_concurrent_index(:ci_builds, :stage_id, where: 'stage_id IS NULL',
name: 'tmp_stage_id_partial_null_index')
add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL',
name: 'tmp_id_partial_null_index')
end
def down
remove_concurrent_index_by_name(:ci_builds, 'tmp_stage_id_partial_null_index')
remove_concurrent_index_by_name(:ci_builds, 'tmp_id_partial_null_index')
end
end

View file

@ -4,11 +4,11 @@ class RemoveTmpPartialNullIndexFromBuilds < ActiveRecord::Migration
disable_ddl_transaction!
def up
remove_concurrent_index_by_name(:ci_builds, 'tmp_stage_id_partial_null_index')
remove_concurrent_index_by_name(:ci_builds, 'tmp_id_partial_null_index')
end
def down
add_concurrent_index(:ci_builds, :stage_id, where: 'stage_id IS NULL',
name: 'tmp_stage_id_partial_null_index')
add_concurrent_index(:ci_builds, :id, where: 'stage_id IS NULL',
name: 'tmp_id_partial_null_index')
end
end