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

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

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

  TMP_INDEX_NAME = 'tmp_index_on_mr_metrics_target_project_id_null'
  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :merge_request_metrics, :id, where: 'target_project_id IS NULL', name: TMP_INDEX_NAME
  end

  def down
    remove_concurrent_index_by_name :merge_request_metrics, name: TMP_INDEX_NAME
  end
end