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

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

  DOWNTIME = false

  disable_ddl_transaction!

  INDEX = 'tmp_build_stage_position_index'

  def up
    remove_concurrent_index_by_name :ci_builds, INDEX
  end

  def down
    add_concurrent_index :ci_builds, [:stage_id, :stage_idx], where: 'stage_idx IS NOT NULL', name: INDEX
  end
end