summaryrefslogtreecommitdiff
path: root/db/migrate/20190815093936_add_index_notes_on_project_id_and_id_and_system_false.rb
blob: cbbece35901d3c79ee45e27091891eab136ae9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

class AddIndexNotesOnProjectIdAndIdAndSystemFalse < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index(*index_arguments)
  end

  def down
    remove_concurrent_index(*index_arguments)
  end

  private

  def index_arguments
    [
      :notes,
      [:project_id, :id],
      {
        name: 'index_notes_on_project_id_and_id_and_system_false',
        where: 'NOT system'
      }
    ]
  end
end