Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20220720171102_add_index_on_vulnerability_reads_namespace_id.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e90fcfd3016d705b9e49d55457d5d17b5571b2a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class AddIndexOnVulnerabilityReadsNamespaceId < Gitlab::Database::Migration[2.0]
  INDEX_NAME = 'index_vuln_reads_on_namespace_id_state_severity_and_vuln_id'

  disable_ddl_transaction!

  def up
    add_concurrent_index :vulnerability_reads,
                         [:namespace_id, :state, :severity, :vulnerability_id],
                         name: INDEX_NAME,
                         order: { vulnerability_id: :desc }
  end

  def down
    remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
  end
end