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