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

20171207185153_add_merge_request_state_index.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 167470cf7fe6fc57b6417607e295bcc33077f3d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class AddMergeRequestStateIndex < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :merge_requests, [:source_project_id, :source_branch],
                         where: "state = 'opened'",
                         name: 'index_merge_requests_on_source_project_and_branch_state_opened'
  end

  def down
    remove_concurrent_index_by_name :merge_requests,
                                    'index_merge_requests_on_source_project_and_branch_state_opened'
  end
end