Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20210629153519_add_index_to_bulk_import_entities_on_bulk_import_id_and_status.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c84a42cbea425b437eb73d45a4f0ff120e7ab67b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

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

  disable_ddl_transaction!

  NEW_INDEX_NAME = 'index_bulk_import_entities_on_bulk_import_id_and_status'
  OLD_INDEX_NAME = 'index_bulk_import_entities_on_bulk_import_id'

  def up
    add_concurrent_index :bulk_import_entities, [:bulk_import_id, :status], name: NEW_INDEX_NAME
    remove_concurrent_index_by_name :bulk_import_entities, name: OLD_INDEX_NAME
  end

  def down
    add_concurrent_index :bulk_import_entities, :bulk_import_id, name: OLD_INDEX_NAME
    remove_concurrent_index_by_name :bulk_import_entities, name: NEW_INDEX_NAME
  end
end