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

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

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

  NEW_INDEX_NAME = 'index_vulnerabilities_common_finder_query_on_default_branch'
  OLD_INDEX_NAME = 'index_vulnerabilites_common_finder_query'

  def up
    add_concurrent_index :vulnerabilities, [:project_id, :state, :report_type, :present_on_default_branch,
                                            :severity, :id], name: NEW_INDEX_NAME

    remove_concurrent_index_by_name(:vulnerabilities, OLD_INDEX_NAME)
  end

  def down
    add_concurrent_index :vulnerabilities, [:project_id, :state, :report_type, :severity, :id], name: OLD_INDEX_NAME

    remove_concurrent_index_by_name(:vulnerabilities, NEW_INDEX_NAME)
  end
end