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

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

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

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :merge_requests, :sprint_id
    add_concurrent_foreign_key :merge_requests, :sprints, column: :sprint_id
  end

  def down
    with_lock_retries do
      remove_foreign_key :merge_requests, column: :sprint_id
    end
    remove_concurrent_index :merge_requests, :sprint_id
  end
end