diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 11:20:51 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-09-20 13:23:14 +0530 |
commit | b43d3af782c52b060205e63720857bbf462d6b6e (patch) | |
tree | 8e1aec742c9d8a239ca90660111ae9fad0b94fc0 | |
parent | d0e101e997347b0b52d4ef3a945a0f26571546a2 (diff) | |
download | gitlab-ce-b43d3af782c52b060205e63720857bbf462d6b6e.tar.gz |
Miscellaneous cycle-analytics-related changes.
1. Add indexes to `CreateMergeRequestsClosingIssues` columns.
2. Remove an extraneous `check_if_open` check that is redundant now.
It would've been better to rebase this in, but that's not possible
because more people are working on this branch.
-rw-r--r-- | app/models/issue.rb | 6 | ||||
-rw-r--r-- | db/migrate/20160915042921_create_merge_requests_closing_issues.rb | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 371b3f4ee73..2403748d017 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -210,11 +210,7 @@ class Issue < ActiveRecord::Base note.all_references(current_user, extractor: ext) end - if check_if_open - ext.merge_requests.select { |mr| mr.open? && mr.closes_issue?(self) } - else - ext.merge_requests.select { |mr| mr.closes_issue?(self) } - end + ext.merge_requests.select { |mr| mr.open? && mr.closes_issue?(self) } end def moved? diff --git a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb index bc0814eeaeb..02c28cbe0dd 100644 --- a/db/migrate/20160915042921_create_merge_requests_closing_issues.rb +++ b/db/migrate/20160915042921_create_merge_requests_closing_issues.rb @@ -25,8 +25,8 @@ class CreateMergeRequestsClosingIssues < ActiveRecord::Migration def change create_table :merge_requests_closing_issues do |t| - t.references :merge_request, foreign_key: true, null: false - t.references :issue, foreign_key: true, null: false + t.references :merge_request, foreign_key: true, index: true, null: false + t.references :issue, foreign_key: true, index: true, null: false t.timestamps null: false end |