summaryrefslogtreecommitdiff
path: root/db/post_migrate/20221003192827_add_index_resolved_on_default_branch_to_vulnerabilities_read.rb
blob: e352e32418792d68cda835cfacb2bc9cc35f8983 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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

  INDEX_NAME = 'index_vuln_reads_on_resolved_on_default_branch'
  COLUMNS = %i[project_id state id]

  def up
    add_concurrent_index :vulnerability_reads, COLUMNS,
                         where: 'resolved_on_default_branch IS TRUE',
                         name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :vulnerability_reads, INDEX_NAME
  end
end