summaryrefslogtreecommitdiff
path: root/db/migrate/20220506180411_add_index_to_vulnerability_feedback_finding_uuid.rb
blob: a6f01ce5a0ebb6efeb91b69b1a8e932aaf497433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class AddIndexToVulnerabilityFeedbackFindingUuid < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_vulnerability_feedback_finding_uuid'

  # We are indexing on UUID, a hash index should be smaller and faster
  # details on https://gitlab.com/gitlab-org/gitlab/-/merge_requests/86808#note_943330140
  def up
    add_concurrent_index :vulnerability_feedback, :finding_uuid, using: :hash, name: INDEX_NAME
  end

  def down
    remove_concurrent_index :vulnerability_feedback, :finding_uuid, using: :hash, name: INDEX_NAME
  end
end