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

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

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :notes, [:author_id, :created_at, :id]
    remove_concurrent_index :notes, [:author_id, :created_at]
  end

  def down
    add_concurrent_index :notes, [:author_id, :created_at]
    remove_concurrent_index :notes, [:author_id, :created_at, :id]
  end
end