summaryrefslogtreecommitdiff
path: root/db/post_migrate/20210610113229_add_index_to_protected_pending_builds.rb
blob: 140bf7df4e697a9c4b38ec9f3ca61fb7dc606372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

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

  INDEX_NAME = 'index_ci_pending_builds_id_on_protected_partial'

  disable_ddl_transaction!

  def up
    add_concurrent_index :ci_pending_builds, :id, where: 'protected = true', name: INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :ci_pending_builds, INDEX_NAME
  end
end