summaryrefslogtreecommitdiff
path: root/db/migrate/20180320182229_add_indexes_for_user_activity_queries.rb
blob: 3232d5fe1e5dfe8cacf5458bb3f3118c73b76551 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class AddIndexesForUserActivityQueries < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    add_concurrent_index :events, [:project_id, :author_id]
    add_concurrent_index :user_interacted_projects, :user_id
  end

  def down
    remove_concurrent_index :events, [:project_id, :author_id]
    remove_concurrent_index :user_interacted_projects, :user_id
  end
end