summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-04-26 13:06:06 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-04-26 13:06:06 +0200
commit52bd4b88dc557f0b3c63e82d0f2093f22b28ae9d (patch)
tree485f4cd552277257a265ddb2880db36ee8a11126
parent0eca206c117c0f3cc50dfa6ce06d5dd96e446803 (diff)
parente780473d4e075b75bb25cd7606ee866827d2c481 (diff)
downloadgitlab-ce-52bd4b88dc557f0b3c63e82d0f2093f22b28ae9d.tar.gz
Merge branch 'blackst0ne/gitlab-ce-add_index_on_ci_builds_user_id'
This manually merges https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10874 into master after resolving conflicts.
-rw-r--r--changelogs/unreleased/add_index_on_ci_builds_user_id.yml4
-rw-r--r--db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb19
-rw-r--r--db/schema.rb1
3 files changed, 24 insertions, 0 deletions
diff --git a/changelogs/unreleased/add_index_on_ci_builds_user_id.yml b/changelogs/unreleased/add_index_on_ci_builds_user_id.yml
new file mode 100644
index 00000000000..655ebdb76fa
--- /dev/null
+++ b/changelogs/unreleased/add_index_on_ci_builds_user_id.yml
@@ -0,0 +1,4 @@
+---
+title: Add index on ci_builds.user_id
+merge_request: 10874
+author: blackst0ne
diff --git a/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb b/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
new file mode 100644
index 00000000000..348d5dbc270
--- /dev/null
+++ b/db/migrate/20170424095707_add_index_on_ci_builds_user_id.rb
@@ -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
diff --git a/db/schema.rb b/db/schema.rb
index bd6fef22d06..ff00951d5f6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"