diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-02-05 19:52:06 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-02-15 09:50:32 +0100 |
commit | 18a8ea564986f69dd7c9e1e8ec923cec107e0350 (patch) | |
tree | 1cd4c55b9bda3ce1277001674b71759ec201798b | |
parent | d55d2256e1e57f604cccdaec074a4238c3073e6c (diff) | |
download | gitlab-ce-18a8ea564986f69dd7c9e1e8ec923cec107e0350.tar.gz |
Merge branch 'sh-add-index-for-label-count' into 'master'
Add index to labels for `type` and project_id`
Closes #27676
See merge request !8978
-rw-r--r-- | db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb b/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb new file mode 100644 index 00000000000..8f944930807 --- /dev/null +++ b/db/migrate/20170204181513_add_index_to_labels_for_type_and_project.rb @@ -0,0 +1,11 @@ +class AddIndexToLabelsForTypeAndProject < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + add_concurrent_index :labels, [:type, :project_id] + end +end diff --git a/db/schema.rb b/db/schema.rb index 5efb4f6595c..2d963969921 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170130204620) do +ActiveRecord::Schema.define(version: 20170204181513) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -575,6 +575,7 @@ ActiveRecord::Schema.define(version: 20170130204620) do end add_index "labels", ["group_id", "project_id", "title"], name: "index_labels_on_group_id_and_project_id_and_title", unique: true, using: :btree + add_index "labels", ["type", "project_id"], name: "index_labels_on_type_and_project_id", using: :btree create_table "lfs_objects", force: :cascade do |t| t.string "oid", null: false |