]> source.dussan.org Git - redmine.git/commitdiff
Adding missing database indexes for foreign keys and STI fields.
authorEric Davis <edavis@littlestreamsoftware.com>
Sat, 17 Oct 2009 22:23:29 +0000 (22:23 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sat, 17 Oct 2009 22:23:29 +0000 (22:23 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2928 e93f8b46-1217-0410-a6f0-8f06a7374b81

30 files changed:
db/migrate/20091017212227_add_missing_indexes_to_workflows.rb [new file with mode: 0644]
db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb [new file with mode: 0644]
db/migrate/20091017212644_add_missing_indexes_to_messages.rb [new file with mode: 0644]
db/migrate/20091017212938_add_missing_indexes_to_repositories.rb [new file with mode: 0644]
db/migrate/20091017213027_add_missing_indexes_to_comments.rb [new file with mode: 0644]
db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb [new file with mode: 0644]
db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb [new file with mode: 0644]
db/migrate/20091017213228_add_missing_indexes_to_watchers.rb [new file with mode: 0644]
db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb [new file with mode: 0644]
db/migrate/20091017213332_add_missing_indexes_to_documents.rb [new file with mode: 0644]
db/migrate/20091017213444_add_missing_indexes_to_tokens.rb [new file with mode: 0644]
db/migrate/20091017213536_add_missing_indexes_to_changesets.rb [new file with mode: 0644]
db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb [new file with mode: 0644]
db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb [new file with mode: 0644]
db/migrate/20091017213757_add_missing_indexes_to_boards.rb [new file with mode: 0644]
db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb [new file with mode: 0644]
db/migrate/20091017213910_add_missing_indexes_to_issues.rb [new file with mode: 0644]
db/migrate/20091017214015_add_missing_indexes_to_members.rb [new file with mode: 0644]
db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb [new file with mode: 0644]
db/migrate/20091017214136_add_missing_indexes_to_queries.rb [new file with mode: 0644]
db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb [new file with mode: 0644]
db/migrate/20091017214308_add_missing_indexes_to_news.rb [new file with mode: 0644]
db/migrate/20091017214336_add_missing_indexes_to_users.rb [new file with mode: 0644]
db/migrate/20091017214406_add_missing_indexes_to_attachments.rb [new file with mode: 0644]
db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb [new file with mode: 0644]
db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb [new file with mode: 0644]
db/migrate/20091017214611_add_missing_indexes_to_journals.rb [new file with mode: 0644]
db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb [new file with mode: 0644]
db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb [new file with mode: 0644]
db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb [new file with mode: 0644]

diff --git a/db/migrate/20091017212227_add_missing_indexes_to_workflows.rb b/db/migrate/20091017212227_add_missing_indexes_to_workflows.rb
new file mode 100644 (file)
index 0000000..13fa013
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb b/db/migrate/20091017212457_add_missing_indexes_to_custom_fields_projects.rb
new file mode 100644 (file)
index 0000000..b95f543
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017212644_add_missing_indexes_to_messages.rb b/db/migrate/20091017212644_add_missing_indexes_to_messages.rb
new file mode 100644 (file)
index 0000000..23c2729
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017212938_add_missing_indexes_to_repositories.rb b/db/migrate/20091017212938_add_missing_indexes_to_repositories.rb
new file mode 100644 (file)
index 0000000..b9f43b6
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213027_add_missing_indexes_to_comments.rb b/db/migrate/20091017213027_add_missing_indexes_to_comments.rb
new file mode 100644 (file)
index 0000000..2a1ed27
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb b/db/migrate/20091017213113_add_missing_indexes_to_enumerations.rb
new file mode 100644 (file)
index 0000000..85dedf8
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb b/db/migrate/20091017213151_add_missing_indexes_to_wiki_pages.rb
new file mode 100644 (file)
index 0000000..7fab09e
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213228_add_missing_indexes_to_watchers.rb b/db/migrate/20091017213228_add_missing_indexes_to_watchers.rb
new file mode 100644 (file)
index 0000000..618e1cd
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb b/db/migrate/20091017213257_add_missing_indexes_to_auth_sources.rb
new file mode 100644 (file)
index 0000000..ccd4f04
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213332_add_missing_indexes_to_documents.rb b/db/migrate/20091017213332_add_missing_indexes_to_documents.rb
new file mode 100644 (file)
index 0000000..f519018
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213444_add_missing_indexes_to_tokens.rb b/db/migrate/20091017213444_add_missing_indexes_to_tokens.rb
new file mode 100644 (file)
index 0000000..f0979f2
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213536_add_missing_indexes_to_changesets.rb b/db/migrate/20091017213536_add_missing_indexes_to_changesets.rb
new file mode 100644 (file)
index 0000000..303be83
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb b/db/migrate/20091017213642_add_missing_indexes_to_issue_categories.rb
new file mode 100644 (file)
index 0000000..3f5b2b1
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb b/db/migrate/20091017213716_add_missing_indexes_to_member_roles.rb
new file mode 100644 (file)
index 0000000..e9ff62d
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213757_add_missing_indexes_to_boards.rb b/db/migrate/20091017213757_add_missing_indexes_to_boards.rb
new file mode 100644 (file)
index 0000000..d3e9422
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb b/db/migrate/20091017213835_add_missing_indexes_to_user_preferences.rb
new file mode 100644 (file)
index 0000000..f3a8ccb
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017213910_add_missing_indexes_to_issues.rb b/db/migrate/20091017213910_add_missing_indexes_to_issues.rb
new file mode 100644 (file)
index 0000000..d651a54
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214015_add_missing_indexes_to_members.rb b/db/migrate/20091017214015_add_missing_indexes_to_members.rb
new file mode 100644 (file)
index 0000000..5fdf560
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb b/db/migrate/20091017214107_add_missing_indexes_to_custom_fields.rb
new file mode 100644 (file)
index 0000000..18be0b4
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214136_add_missing_indexes_to_queries.rb b/db/migrate/20091017214136_add_missing_indexes_to_queries.rb
new file mode 100644 (file)
index 0000000..414b1ad
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb b/db/migrate/20091017214236_add_missing_indexes_to_time_entries.rb
new file mode 100644 (file)
index 0000000..cffc528
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214308_add_missing_indexes_to_news.rb b/db/migrate/20091017214308_add_missing_indexes_to_news.rb
new file mode 100644 (file)
index 0000000..808eb62
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214336_add_missing_indexes_to_users.rb b/db/migrate/20091017214336_add_missing_indexes_to_users.rb
new file mode 100644 (file)
index 0000000..c5a5095
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214406_add_missing_indexes_to_attachments.rb b/db/migrate/20091017214406_add_missing_indexes_to_attachments.rb
new file mode 100644 (file)
index 0000000..d22fc98
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb b/db/migrate/20091017214440_add_missing_indexes_to_wiki_contents.rb
new file mode 100644 (file)
index 0000000..454e4c5
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb b/db/migrate/20091017214519_add_missing_indexes_to_custom_values.rb
new file mode 100644 (file)
index 0000000..b192a7e
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214611_add_missing_indexes_to_journals.rb b/db/migrate/20091017214611_add_missing_indexes_to_journals.rb
new file mode 100644 (file)
index 0000000..2667f40
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb b/db/migrate/20091017214644_add_missing_indexes_to_issue_relations.rb
new file mode 100644 (file)
index 0000000..fc57f18
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb b/db/migrate/20091017214720_add_missing_indexes_to_wiki_redirects.rb
new file mode 100644 (file)
index 0000000..7442a54
--- /dev/null
@@ -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
diff --git a/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb b/db/migrate/20091017214750_add_missing_indexes_to_custom_fields_trackers.rb
new file mode 100644 (file)
index 0000000..c398b79
--- /dev/null
@@ -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