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

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

class AddIndexToVulnerabilityReads < Gitlab::Database::Migration[1.0]
  INDEX_NAME = 'index_vulnerability_reads_common_finder_query'

  disable_ddl_transaction!

  def up
    add_concurrent_index(
      :vulnerability_reads,
      %i[project_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