--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+class AddMissingIndexesToRepositories < ActiveRecord::Migration
+ def self.up
+ add_index :repositories, :project_id
+ end
+
+ def self.down
+ remove_index :repositories, :project_id
+ end
+end
--- /dev/null
+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
--- /dev/null
+class AddMissingIndexesToEnumerations < ActiveRecord::Migration
+ def self.up
+ add_index :enumerations, [:id, :type]
+ end
+
+ def self.down
+ remove_index :enumerations, :column => [:id, :type]
+ end
+end
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+class AddMissingIndexesToDocuments < ActiveRecord::Migration
+ def self.up
+ add_index :documents, :category_id
+ end
+
+ def self.down
+ remove_index :documents, :category_id
+ end
+end
--- /dev/null
+class AddMissingIndexesToTokens < ActiveRecord::Migration
+ def self.up
+ add_index :tokens, :user_id
+ end
+
+ def self.down
+ remove_index :tokens, :user_id
+ end
+end
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+class AddMissingIndexesToNews < ActiveRecord::Migration
+ def self.up
+ add_index :news, :author_id
+ end
+
+ def self.down
+ remove_index :news, :author_id
+ end
+end
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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