summaryrefslogtreecommitdiff
path: root/db/migrate/20200306192548_add_index_on_project_id_and_type_to_services.rb
blob: 9deb3c2832dfff9844ce6f4dbb6df617612d7c85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

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

  DOWNTIME = false
  INDEX_NAME = 'index_services_on_project_id'

  disable_ddl_transaction!

  def up
    add_concurrent_index :services, [:project_id, :type]

    remove_concurrent_index_by_name :services, INDEX_NAME
  end

  def down
    add_concurrent_index :services, :project_id, name: INDEX_NAME

    remove_concurrent_index :services, [:project_id, :type]
  end
end