summaryrefslogtreecommitdiff
path: root/db/migrate/20201022192254_index_project_settings_on_project_id_partially.rb
blob: 57247bd0f22060670abf3524367921009d484c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class IndexProjectSettingsOnProjectIdPartially < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_project_settings_on_project_id_partially'

  disable_ddl_transaction!

  def up
    add_concurrent_index :project_settings, :project_id, name: INDEX_NAME, where: 'has_vulnerabilities IS TRUE'
  end

  def down
    remove_concurrent_index_by_name :project_settings, INDEX_NAME
  end
end