Commit 9787c37aed0c934d9ae4f6786413eb25b55c3a17

Authored by Dmitriy Zaporozhets
1 parent ee13297a

More db index

db/migrate/20130622115340_add_more_db_index.rb 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +class AddMoreDbIndex < ActiveRecord::Migration
  2 + def change
  3 + add_index :deploy_keys_projects, :project_id
  4 + add_index :web_hooks, :project_id
  5 + add_index :protected_branches, :project_id
  6 +
  7 + add_index :users_groups, :user_id
  8 + add_index :snippets, :author_id
  9 + add_index :notes, :author_id
  10 + add_index :notes, [:noteable_id, :noteable_type]
  11 + end
  12 +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 => 20130621195223) do
  14 +ActiveRecord::Schema.define(:version => 20130622115340) do
15 15  
16 16 create_table "deploy_keys_projects", :force => true do |t|
17 17 t.integer "deploy_key_id", :null => false
... ... @@ -20,6 +20,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
20 20 t.datetime "updated_at", :null => false
21 21 end
22 22  
  23 + add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id"
  24 +
23 25 create_table "events", :force => true do |t|
24 26 t.string "target_type"
25 27 t.integer "target_id"
... ... @@ -148,8 +150,10 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
148 150 t.integer "noteable_id"
149 151 end
150 152  
  153 + add_index "notes", ["author_id"], :name => "index_notes_on_author_id"
151 154 add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id"
152 155 add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
  156 + add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type"
153 157 add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
154 158 add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type"
155 159 add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
... ... @@ -186,6 +190,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
186 190 t.datetime "updated_at", :null => false
187 191 end
188 192  
  193 + add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id"
  194 +
189 195 create_table "services", :force => true do |t|
190 196 t.string "type"
191 197 t.string "title"
... ... @@ -214,6 +220,7 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
214 220 t.string "type"
215 221 end
216 222  
  223 + add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id"
217 224 add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
218 225 add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
219 226 add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
... ... @@ -310,6 +317,8 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
310 317 t.integer "notification_level", :default => 3, :null => false
311 318 end
312 319  
  320 + add_index "users_groups", ["user_id"], :name => "index_users_groups_on_user_id"
  321 +
313 322 create_table "users_projects", :force => true do |t|
314 323 t.integer "user_id", :null => false
315 324 t.integer "project_id", :null => false
... ... @@ -332,4 +341,6 @@ ActiveRecord::Schema.define(:version =&gt; 20130621195223) do
332 341 t.integer "service_id"
333 342 end
334 343  
  344 + add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id"
  345 +
335 346 end
... ...