debian-mirror-gitlab/db/migrate/20221025145452_change_vulnerability_feedback_unique_idx.rb
2023-01-12 18:35:48 +00:00

25 lines
852 B
Ruby

# frozen_string_literal: true
class ChangeVulnerabilityFeedbackUniqueIdx < Gitlab::Database::Migration[2.0]
NEW_INDEX_NAME = :index_vulnerability_feedback_on_common_attributes
OLD_INDEX_NAME = :vulnerability_feedback_unique_idx
disable_ddl_transaction!
def up
add_concurrent_index :vulnerability_feedback,
%i[project_id category feedback_type project_fingerprint],
name: NEW_INDEX_NAME
remove_concurrent_index_by_name :vulnerability_feedback, OLD_INDEX_NAME
end
def down
add_concurrent_index :vulnerability_feedback,
%i[project_id category feedback_type project_fingerprint],
name: OLD_INDEX_NAME,
unique: true
remove_concurrent_index_by_name :vulnerability_feedback, NEW_INDEX_NAME
end
end