Commit 39e3f64d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'dz-add-indices-to-abuse-reports' into 'master'

Add indices to abuse_reports table

Closes #35621

See merge request gitlab-org/gitlab!19630
parents f08be33b b032cc78
......@@ -4,7 +4,7 @@ class Admin::AbuseReportsController < Admin::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord
def index
@abuse_reports = AbuseReport.order(id: :desc).page(params[:page])
@abuse_reports.includes(:reporter, :user)
@abuse_reports = @abuse_reports.includes(:user, :reporter)
end
# rubocop: enable CodeReuse/ActiveRecord
......
---
title: Improve performance of admin/abuse_reports page
merge_request: 19630
author:
type: performance
# frozen_string_literal: true
class AddIndicesToAbuseReports < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :abuse_reports, :user_id
end
def down
remove_concurrent_index :abuse_reports, :user_id
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_11_05_094625) do
ActiveRecord::Schema.define(version: 2019_11_05_140942) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -24,6 +24,7 @@ ActiveRecord::Schema.define(version: 2019_11_05_094625) do
t.datetime "updated_at"
t.text "message_html"
t.integer "cached_markdown_version"
t.index ["user_id"], name: "index_abuse_reports_on_user_id"
end
create_table "alerts_service_data", force: :cascade do |t|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment