debian-mirror-gitlab/db/post_migrate/20230203122609_change_pipeline_name_index.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
695 B
Ruby
Raw Normal View History

2023-04-23 21:23:45 +05:30
# frozen_string_literal: true
class ChangePipelineNameIndex < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
OLD_INDEX_NAME = 'index_pipeline_metadata_on_pipeline_id_name_lower_text_pattern'
NEW_INDEX_NAME = 'index_pipeline_metadata_on_pipeline_id_name_text_pattern'
def up
add_concurrent_index :ci_pipeline_metadata, 'pipeline_id, name text_pattern_ops', name: NEW_INDEX_NAME
remove_concurrent_index_by_name :ci_pipeline_metadata, OLD_INDEX_NAME
end
def down
add_concurrent_index :ci_pipeline_metadata, 'pipeline_id, lower(name) text_pattern_ops', name: OLD_INDEX_NAME
remove_concurrent_index_by_name :ci_pipeline_metadata, NEW_INDEX_NAME
end
end