summaryrefslogtreecommitdiff
path: root/db/migrate/20200903092241_add_index_to_resource_iteration_events_add_events.rb
blob: be530f1f9b5dab27dbb9477698db783bba613079 (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 AddIndexToResourceIterationEventsAddEvents < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX_NAME = 'index_resource_iteration_events_on_iteration_id_and_add_action'
  ADD_ACTION = '1'

  def up
    # Index add iteration events
    add_concurrent_index :resource_iteration_events, :iteration_id, where: "action = #{ADD_ACTION}", name: INDEX_NAME
  end

  def down
    remove_concurrent_index :resource_iteration_events, :iteration_id, name: INDEX_NAME
  end
end