Adding missing database indexes for foreign keys and STI fields.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2928 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
07ffad4a7e
commit
70118fb136
|
@ -0,0 +1,13 @@
|
|||
class AddMissingIndexesToWorkflows < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :workflows, :old_status_id
|
||||
add_index :workflows, :role_id
|
||||
add_index :workflows, :new_status_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :workflows, :old_status_id
|
||||
remove_index :workflows, :role_id
|
||||
remove_index :workflows, :new_status_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToCustomFieldsProjects < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :custom_fields_projects, [:custom_field_id, :project_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :custom_fields_projects, :column => [:custom_field_id, :project_id]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToMessages < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :messages, :last_reply_id
|
||||
add_index :messages, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :messages, :last_reply_id
|
||||
remove_index :messages, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToRepositories < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :repositories, :project_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :repositories, :project_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToComments < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :comments, [:commented_id, :commented_type]
|
||||
add_index :comments, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :comments, :column => [:commented_id, :commented_type]
|
||||
remove_index :comments, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToEnumerations < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :enumerations, [:id, :type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :enumerations, :column => [:id, :type]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToWikiPages < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :wiki_pages, :wiki_id
|
||||
add_index :wiki_pages, :parent_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :wiki_pages, :wiki_id
|
||||
remove_index :wiki_pages, :parent_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToWatchers < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :watchers, :user_id
|
||||
add_index :watchers, [:watchable_id, :watchable_type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :watchers, :user_id
|
||||
remove_index :watchers, :column => [:watchable_id, :watchable_type]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToAuthSources < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :auth_sources, [:id, :type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :auth_sources, :column => [:id, :type]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToDocuments < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :documents, :category_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :documents, :category_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToTokens < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :tokens, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :tokens, :user_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToChangesets < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :changesets, :user_id
|
||||
add_index :changesets, :repository_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :changesets, :user_id
|
||||
remove_index :changesets, :repository_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToIssueCategories < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :issue_categories, :assigned_to_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :issue_categories, :assigned_to_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToMemberRoles < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :member_roles, :member_id
|
||||
add_index :member_roles, :role_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :member_roles, :member_id
|
||||
remove_index :member_roles, :role_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToBoards < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :boards, :last_message_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :boards, :last_message_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToUserPreferences < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :user_preferences, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :user_preferences, :user_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,21 @@
|
|||
class AddMissingIndexesToIssues < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :issues, :status_id
|
||||
add_index :issues, :category_id
|
||||
add_index :issues, :assigned_to_id
|
||||
add_index :issues, :fixed_version_id
|
||||
add_index :issues, :tracker_id
|
||||
add_index :issues, :priority_id
|
||||
add_index :issues, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :issues, :status_id
|
||||
remove_index :issues, :category_id
|
||||
remove_index :issues, :assigned_to_id
|
||||
remove_index :issues, :fixed_version_id
|
||||
remove_index :issues, :tracker_id
|
||||
remove_index :issues, :priority_id
|
||||
remove_index :issues, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToMembers < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :members, :user_id
|
||||
add_index :members, :project_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :members, :user_id
|
||||
remove_index :members, :project_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToCustomFields < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :custom_fields, [:id, :type]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :custom_fields, :column => [:id, :type]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToQueries < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :queries, :project_id
|
||||
add_index :queries, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :queries, :project_id
|
||||
remove_index :queries, :user_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToTimeEntries < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :time_entries, :activity_id
|
||||
add_index :time_entries, :user_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :time_entries, :activity_id
|
||||
remove_index :time_entries, :user_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToNews < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :news, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :news, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToUsers < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :users, [:id, :type]
|
||||
add_index :users, :auth_source_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :users, :column => [:id, :type]
|
||||
remove_index :users, :auth_source_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToAttachments < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :attachments, [:container_id, :container_type]
|
||||
add_index :attachments, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :attachments, :column => [:container_id, :container_type]
|
||||
remove_index :attachments, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToWikiContents < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :wiki_contents, :author_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :wiki_contents, :author_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToCustomValues < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :custom_values, :custom_field_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :custom_values, :custom_field_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToJournals < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :journals, :user_id
|
||||
add_index :journals, :journalized_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :journals, :user_id
|
||||
remove_index :journals, :journalized_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddMissingIndexesToIssueRelations < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :issue_relations, :issue_from_id
|
||||
add_index :issue_relations, :issue_to_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :issue_relations, :issue_from_id
|
||||
remove_index :issue_relations, :issue_to_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToWikiRedirects < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :wiki_redirects, :wiki_id
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :wiki_redirects, :wiki_id
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddMissingIndexesToCustomFieldsTrackers < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :custom_fields_trackers, [:custom_field_id, :tracker_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :custom_fields_trackers, :column => [:custom_field_id, :tracker_id]
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue