summaryrefslogtreecommitdiff
path: root/db/migrate/20180417101040_add_tmp_stage_priority_index_to_ci_builds.rb
blob: ee82c70ecf879244dcea09eec9f25417910f4c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class AddTmpStagePriorityIndexToCiBuilds < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index(:ci_builds, [:stage_id, :stage_idx],
                         where: 'stage_idx IS NOT NULL', name: 'tmp_build_stage_position_index')
  end

  def down
    remove_concurrent_index_by_name(:ci_builds, 'tmp_build_stage_position_index')
  end
end