Add index on ci_builds.user_id
This commit is contained in:
parent
0eca206c11
commit
e780473d4e
3 changed files with 24 additions and 0 deletions
4
changelogs/unreleased/add_index_on_ci_builds_user_id.yml
Normal file
4
changelogs/unreleased/add_index_on_ci_builds_user_id.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Add index on ci_builds.user_id
|
||||
merge_request: 10874
|
||||
author: blackst0ne
|
19
db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
Normal file
19
db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
|
||||
# for more information on how to write migrations for GitLab.
|
||||
|
||||
class AddIndexOnCiBuildsUserId < ActiveRecord::Migration
|
||||
include Gitlab::Database::MigrationHelpers
|
||||
|
||||
# Set this constant to true if this migration requires downtime.
|
||||
DOWNTIME = false
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
add_concurrent_index :ci_builds, :user_id
|
||||
end
|
||||
|
||||
def down
|
||||
remove_concurrent_index :ci_builds, :user_id if index_exists?(:ci_builds, :user_id)
|
||||
end
|
||||
end
|
|
@ -242,6 +242,7 @@ ActiveRecord::Schema.define(version: 20170424142900) do
|
|||
add_index "ci_builds", ["status"], name: "index_ci_builds_on_status", using: :btree
|
||||
add_index "ci_builds", ["token"], name: "index_ci_builds_on_token", unique: true, using: :btree
|
||||
add_index "ci_builds", ["updated_at"], name: "index_ci_builds_on_updated_at", using: :btree
|
||||
add_index "ci_builds", ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
|
||||
|
||||
create_table "ci_pipelines", force: :cascade do |t|
|
||||
t.string "ref"
|
||||
|
|
Loading…
Reference in a new issue