Commit 7b97e3044988e41e65e8186f2dadf87e5837b101
1 parent
8dec24a3
Exists in
master
and in
4 other branches
More indices for asscociations. related to #2159
Showing
2 changed files
with
47 additions
and
1 deletions
Show diff stats
... | ... | @@ -0,0 +1,26 @@ |
1 | +class MoreIndices < ActiveRecord::Migration | |
2 | + def change | |
3 | + add_index :notes, :project_id | |
4 | + add_index :namespaces, :owner_id | |
5 | + add_index :keys, :user_id | |
6 | + | |
7 | + add_index :projects, :namespace_id | |
8 | + add_index :projects, :owner_id | |
9 | + | |
10 | + add_index :services, :project_id | |
11 | + add_index :snippets, :project_id | |
12 | + | |
13 | + add_index :users_projects, :project_id | |
14 | + | |
15 | + # Issues | |
16 | + add_index :issues, :assignee_id | |
17 | + add_index :issues, :milestone_id | |
18 | + add_index :issues, :author_id | |
19 | + | |
20 | + # Merge Requests | |
21 | + add_index :merge_requests, :assignee_id | |
22 | + add_index :merge_requests, :milestone_id | |
23 | + add_index :merge_requests, :author_id | |
24 | + | |
25 | + end | |
26 | +end | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended to check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(:version => 20121203154450) do | |
14 | +ActiveRecord::Schema.define(:version => 20121203160507) do | |
15 | 15 | |
16 | 16 | create_table "events", :force => true do |t| |
17 | 17 | t.string "target_type" |
... | ... | @@ -44,6 +44,9 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
44 | 44 | t.integer "milestone_id" |
45 | 45 | end |
46 | 46 | |
47 | + add_index "issues", ["assignee_id"], :name => "index_issues_on_assignee_id" | |
48 | + add_index "issues", ["author_id"], :name => "index_issues_on_author_id" | |
49 | + add_index "issues", ["milestone_id"], :name => "index_issues_on_milestone_id" | |
47 | 50 | add_index "issues", ["project_id"], :name => "index_issues_on_project_id" |
48 | 51 | |
49 | 52 | create_table "keys", :force => true do |t| |
... | ... | @@ -56,6 +59,8 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
56 | 59 | t.integer "project_id" |
57 | 60 | end |
58 | 61 | |
62 | + add_index "keys", ["user_id"], :name => "index_keys_on_user_id" | |
63 | + | |
59 | 64 | create_table "merge_requests", :force => true do |t| |
60 | 65 | t.string "target_branch", :null => false |
61 | 66 | t.string "source_branch", :null => false |
... | ... | @@ -73,6 +78,9 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
73 | 78 | t.integer "milestone_id" |
74 | 79 | end |
75 | 80 | |
81 | + add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" | |
82 | + add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" | |
83 | + add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" | |
76 | 84 | add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id" |
77 | 85 | |
78 | 86 | create_table "milestones", :force => true do |t| |
... | ... | @@ -94,6 +102,8 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
94 | 102 | t.string "type" |
95 | 103 | end |
96 | 104 | |
105 | + add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" | |
106 | + | |
97 | 107 | create_table "notes", :force => true do |t| |
98 | 108 | t.text "note" |
99 | 109 | t.string "noteable_id" |
... | ... | @@ -108,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
108 | 118 | |
109 | 119 | add_index "notes", ["noteable_id"], :name => "index_notes_on_noteable_id" |
110 | 120 | add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" |
121 | + add_index "notes", ["project_id"], :name => "index_notes_on_project_id" | |
111 | 122 | |
112 | 123 | create_table "projects", :force => true do |t| |
113 | 124 | t.string "name" |
... | ... | @@ -125,6 +136,9 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
125 | 136 | t.integer "namespace_id" |
126 | 137 | end |
127 | 138 | |
139 | + add_index "projects", ["namespace_id"], :name => "index_projects_on_namespace_id" | |
140 | + add_index "projects", ["owner_id"], :name => "index_projects_on_owner_id" | |
141 | + | |
128 | 142 | create_table "protected_branches", :force => true do |t| |
129 | 143 | t.integer "project_id", :null => false |
130 | 144 | t.string "name", :null => false |
... | ... | @@ -143,6 +157,8 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
143 | 157 | t.string "project_url" |
144 | 158 | end |
145 | 159 | |
160 | + add_index "services", ["project_id"], :name => "index_services_on_project_id" | |
161 | + | |
146 | 162 | create_table "snippets", :force => true do |t| |
147 | 163 | t.string "title" |
148 | 164 | t.text "content" |
... | ... | @@ -154,6 +170,8 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
154 | 170 | t.datetime "expires_at" |
155 | 171 | end |
156 | 172 | |
173 | + add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" | |
174 | + | |
157 | 175 | create_table "taggings", :force => true do |t| |
158 | 176 | t.integer "tag_id" |
159 | 177 | t.integer "taggable_id" |
... | ... | @@ -214,6 +232,8 @@ ActiveRecord::Schema.define(:version => 20121203154450) do |
214 | 232 | t.integer "project_access", :default => 0, :null => false |
215 | 233 | end |
216 | 234 | |
235 | + add_index "users_projects", ["project_id"], :name => "index_users_projects_on_project_id" | |
236 | + | |
217 | 237 | create_table "web_hooks", :force => true do |t| |
218 | 238 | t.string "url" |
219 | 239 | t.integer "project_id" | ... | ... |