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

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

  DOWNTIME = false
  INDEX_NAME = 'index_ci_stages_on_pipeline_id_and_id'

  disable_ddl_transaction!

  def up
    add_concurrent_index :ci_stages, %i[pipeline_id id], where: 'status IN (0, 1, 2, 8, 9, 10)', name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :ci_stages, INDEX_NAME
  end
end