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

class AddIndexOnProjectIdToCiPipelines < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  INDEX_NAME = 'index_ci_pipelines_on_project_id_and_id_desc'

  disable_ddl_transaction!

  def up
    add_concurrent_index :ci_pipelines, [:project_id, :id], name: INDEX_NAME, order: { id: :desc }
  end

  def down
    remove_concurrent_index :ci_pipelines, [:project_id, :id], name: INDEX_NAME, order: { id: :desc }
  end
end