summaryrefslogtreecommitdiff
path: root/db/migrate/20210714043818_add_index_for_label_applied_to_issuable_sla.rb
blob: 5931941a95e432949b41de3eab23de457f05d1c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class AddIndexForLabelAppliedToIssuableSla < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  disable_ddl_transaction!

  INDEX_NAME = 'index_issuable_slas_on_due_at_id_label_applied_issuable_closed'

  def up
    add_concurrent_index :issuable_slas, [:due_at, :id], name: INDEX_NAME, where: 'label_applied = FALSE AND issuable_closed = FALSE'
  end

  def down
    remove_concurrent_index_by_name :issuable_slas, INDEX_NAME
  end
end