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

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

class AddIndexOnVulnerabilityReadsNamespaceIdWithReportType < Gitlab::Database::Migration[2.0]
  INDEX_NAME = 'index_vulnerability_reads_common_finder_query_with_namespace_id'

  disable_ddl_transaction!

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

  def down
    remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
  end
end