Commit 8022628f authored by Riyad Preukschas's avatar Riyad Preukschas

Add more indexes (see #2159)

parent 4c3cdfa4
class AddMoreIndexes < ActiveRecord::Migration
def change
add_index :events, :created_at
add_index :events, :target_id
add_index :issues, :closed
add_index :issues, :created_at
add_index :issues, :title
add_index :keys, :identifier
# FIXME: MySQL can't index text columns
#add_index :keys, :key
add_index :keys, :project_id
add_index :merge_requests, :closed
add_index :merge_requests, :created_at
add_index :merge_requests, :source_branch
add_index :merge_requests, :target_branch
add_index :merge_requests, :title
add_index :milestones, :due_date
add_index :milestones, :project_id
add_index :namespaces, :name
add_index :namespaces, :path
add_index :namespaces, :type
add_index :notes, :created_at
add_index :snippets, :created_at
add_index :snippets, :expires_at
add_index :users, :admin
add_index :users, :blocked
add_index :users, :name
add_index :users, :username
add_index :users_projects, :project_access
add_index :users_projects, :user_id
add_index :wikis, :project_id
add_index :wikis, :slug
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121203160507) do ActiveRecord::Schema.define(:version => 20121205201726) do
create_table "events", :force => true do |t| create_table "events", :force => true do |t|
t.string "target_type" t.string "target_type"
...@@ -27,7 +27,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -27,7 +27,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
add_index "events", ["action"], :name => "index_events_on_action" add_index "events", ["action"], :name => "index_events_on_action"
add_index "events", ["author_id"], :name => "index_events_on_author_id" add_index "events", ["author_id"], :name => "index_events_on_author_id"
add_index "events", ["created_at"], :name => "index_events_on_created_at"
add_index "events", ["project_id"], :name => "index_events_on_project_id" add_index "events", ["project_id"], :name => "index_events_on_project_id"
add_index "events", ["target_id"], :name => "index_events_on_target_id"
add_index "events", ["target_type"], :name => "index_events_on_target_type" add_index "events", ["target_type"], :name => "index_events_on_target_type"
create_table "issues", :force => true do |t| create_table "issues", :force => true do |t|
...@@ -46,8 +48,11 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -46,8 +48,11 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
add_index "issues", ["assignee_id"], :name => "index_issues_on_assignee_id" add_index "issues", ["assignee_id"], :name => "index_issues_on_assignee_id"
add_index "issues", ["author_id"], :name => "index_issues_on_author_id" add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
add_index "issues", ["closed"], :name => "index_issues_on_closed"
add_index "issues", ["created_at"], :name => "index_issues_on_created_at"
add_index "issues", ["milestone_id"], :name => "index_issues_on_milestone_id" add_index "issues", ["milestone_id"], :name => "index_issues_on_milestone_id"
add_index "issues", ["project_id"], :name => "index_issues_on_project_id" add_index "issues", ["project_id"], :name => "index_issues_on_project_id"
add_index "issues", ["title"], :name => "index_issues_on_title"
create_table "keys", :force => true do |t| create_table "keys", :force => true do |t|
t.integer "user_id" t.integer "user_id"
...@@ -59,6 +64,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -59,6 +64,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.integer "project_id" t.integer "project_id"
end end
add_index "keys", ["identifier"], :name => "index_keys_on_identifier"
add_index "keys", ["project_id"], :name => "index_keys_on_project_id"
add_index "keys", ["user_id"], :name => "index_keys_on_user_id" add_index "keys", ["user_id"], :name => "index_keys_on_user_id"
create_table "merge_requests", :force => true do |t| create_table "merge_requests", :force => true do |t|
...@@ -80,8 +87,13 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -80,8 +87,13 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id"
add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id"
add_index "merge_requests", ["closed"], :name => "index_merge_requests_on_closed"
add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at"
add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id"
add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id" add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id"
add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch"
add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch"
add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title"
create_table "milestones", :force => true do |t| create_table "milestones", :force => true do |t|
t.string "title", :null => false t.string "title", :null => false
...@@ -93,6 +105,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -93,6 +105,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end end
add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date"
add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id"
create_table "namespaces", :force => true do |t| create_table "namespaces", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.string "path", :null => false t.string "path", :null => false
...@@ -102,7 +117,10 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -102,7 +117,10 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.string "type" t.string "type"
end end
add_index "namespaces", ["name"], :name => "index_namespaces_on_name"
add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id"
add_index "namespaces", ["path"], :name => "index_namespaces_on_path"
add_index "namespaces", ["type"], :name => "index_namespaces_on_type"
create_table "notes", :force => true do |t| create_table "notes", :force => true do |t|
t.text "note" t.text "note"
...@@ -116,6 +134,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -116,6 +134,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.string "line_code" t.string "line_code"
end end
add_index "notes", ["created_at"], :name => "index_notes_on_created_at"
add_index "notes", ["noteable_id"], :name => "index_notes_on_noteable_id" add_index "notes", ["noteable_id"], :name => "index_notes_on_noteable_id"
add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type"
add_index "notes", ["project_id"], :name => "index_notes_on_project_id" add_index "notes", ["project_id"], :name => "index_notes_on_project_id"
...@@ -170,6 +189,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -170,6 +189,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.datetime "expires_at" t.datetime "expires_at"
end end
add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at"
add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at"
add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id"
create_table "taggings", :force => true do |t| create_table "taggings", :force => true do |t|
...@@ -220,9 +241,13 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -220,9 +241,13 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.string "username" t.string "username"
end end
add_index "users", ["admin"], :name => "index_users_on_admin"
add_index "users", ["blocked"], :name => "index_users_on_blocked"
add_index "users", ["email"], :name => "index_users_on_email", :unique => true add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true add_index "users", ["extern_uid", "provider"], :name => "index_users_on_extern_uid_and_provider", :unique => true
add_index "users", ["name"], :name => "index_users_on_name"
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["username"], :name => "index_users_on_username"
create_table "users_projects", :force => true do |t| create_table "users_projects", :force => true do |t|
t.integer "user_id", :null => false t.integer "user_id", :null => false
...@@ -232,7 +257,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -232,7 +257,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.integer "project_access", :default => 0, :null => false t.integer "project_access", :default => 0, :null => false
end end
add_index "users_projects", ["project_access"], :name => "index_users_projects_on_project_access"
add_index "users_projects", ["project_id"], :name => "index_users_projects_on_project_id" add_index "users_projects", ["project_id"], :name => "index_users_projects_on_project_id"
add_index "users_projects", ["user_id"], :name => "index_users_projects_on_user_id"
create_table "web_hooks", :force => true do |t| create_table "web_hooks", :force => true do |t|
t.string "url" t.string "url"
...@@ -253,4 +280,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do ...@@ -253,4 +280,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do
t.integer "user_id" t.integer "user_id"
end end
add_index "wikis", ["project_id"], :name => "index_wikis_on_project_id"
add_index "wikis", ["slug"], :name => "index_wikis_on_slug"
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment