summaryrefslogtreecommitdiff
path: root/db/migrate/20210310000627_add_idx_vulnerability_occurrences_dedup.rb
blob: 5ffcc0052251a6b3f53bd29cd3db6d0d991ab132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class AddIdxVulnerabilityOccurrencesDedup < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  TABLE = :vulnerability_occurrences
  INDEX_NAME = 'index_vulnerability_occurrences_deduplication'
  COLUMNS = %i[project_id report_type project_fingerprint]

  disable_ddl_transaction!

  def up
    add_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
  end

  def down
    remove_concurrent_index TABLE, COLUMNS, name: INDEX_NAME
  end
end