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

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

class AddClusterIdLocationIndexToVulnerabilityOccurrences < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  INDEX_NAME = 'index_vulnerability_occurrences_on_location_cluster_id'

  def up
    add_concurrent_index :vulnerability_occurrences, "(location -> 'cluster_id')",
                         using: 'GIN',
                         where: 'report_type = 7',
                         name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :vulnerability_occurrences, INDEX_NAME
  end
end