summaryrefslogtreecommitdiff
path: root/db/migrate/20210409084242_create_index_on_notes_for_cherry_picked_merge_requests.rb
blob: 2bcdf4c8982fc537e16b8dbe2137c44c3c19c7ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

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

  DOWNTIME = false
  NAME = 'index_notes_for_cherry_picked_merge_requests'

  disable_ddl_transaction!

  def up
    add_concurrent_index :notes, [:project_id, :commit_id], where: "((noteable_type)::text = 'MergeRequest'::text)", name: NAME
  end

  def down
    remove_concurrent_index_by_name :notes, name: NAME
  end
end