diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-12-06 00:50:20 +0400 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2012-12-06 00:50:20 +0400 |
commit | 8022628f7055afb39af71e90ee5d65313d65ebb7 (patch) | |
tree | 40c61e6bcb2fe7593d218ff487d0258988b54737 /db | |
parent | 4c3cdfa4fffb221d797e35913361bedbe1060d44 (diff) |
Add more indexes (see #2159)
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20121205201726_add_more_indexes.rb | 44 | ||||
-rw-r--r-- | db/schema.rb | 32 |
2 files changed, 75 insertions, 1 deletions
diff --git a/db/migrate/20121205201726_add_more_indexes.rb b/db/migrate/20121205201726_add_more_indexes.rb new file mode 100644 index 00000000000..a2b36f7fdf9 --- /dev/null +++ b/db/migrate/20121205201726_add_more_indexes.rb @@ -0,0 +1,44 @@ +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 diff --git a/db/schema.rb b/db/schema.rb index 1abfcb46a26..923d2c5543e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # 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| t.string "target_type" @@ -27,7 +27,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do add_index "events", ["action"], :name => "index_events_on_action" 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", ["target_id"], :name => "index_events_on_target_id" add_index "events", ["target_type"], :name => "index_events_on_target_type" create_table "issues", :force => true do |t| @@ -46,8 +48,11 @@ ActiveRecord::Schema.define(:version => 20121203160507) do 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", ["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", ["project_id"], :name => "index_issues_on_project_id" + add_index "issues", ["title"], :name => "index_issues_on_title" create_table "keys", :force => true do |t| t.integer "user_id" @@ -59,6 +64,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.integer "project_id" 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" create_table "merge_requests", :force => true do |t| @@ -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", ["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", ["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| t.string "title", :null => false @@ -93,6 +105,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.datetime "updated_at", :null => false 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| t.string "name", :null => false t.string "path", :null => false @@ -102,7 +117,10 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.string "type" end + add_index "namespaces", ["name"], :name => "index_namespaces_on_name" 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| t.text "note" @@ -116,6 +134,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.string "line_code" 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_type"], :name => "index_notes_on_noteable_type" add_index "notes", ["project_id"], :name => "index_notes_on_project_id" @@ -170,6 +189,8 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.datetime "expires_at" 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" create_table "taggings", :force => true do |t| @@ -220,9 +241,13 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.string "username" 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", ["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", ["username"], :name => "index_users_on_username" create_table "users_projects", :force => true do |t| t.integer "user_id", :null => false @@ -232,7 +257,9 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.integer "project_access", :default => 0, :null => false 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", ["user_id"], :name => "index_users_projects_on_user_id" create_table "web_hooks", :force => true do |t| t.string "url" @@ -253,4 +280,7 @@ ActiveRecord::Schema.define(:version => 20121203160507) do t.integer "user_id" end + add_index "wikis", ["project_id"], :name => "index_wikis_on_project_id" + add_index "wikis", ["slug"], :name => "index_wikis_on_slug" + end |