OSDN Git Service

Adds an index on watchers table to speed up watched issue filtering.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Feb 2009 19:06:44 +0000 (19:06 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Feb 2009 19:06:44 +0000 (19:06 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2466 e93f8b46-1217-0410-a6f0-8f06a7374b81

db/migrate/20090214190337_add_watchers_user_id_type_index.rb [new file with mode: 0644]

diff --git a/db/migrate/20090214190337_add_watchers_user_id_type_index.rb b/db/migrate/20090214190337_add_watchers_user_id_type_index.rb
new file mode 100644 (file)
index 0000000..7ff4e54
--- /dev/null
@@ -0,0 +1,9 @@
+class AddWatchersUserIdTypeIndex < ActiveRecord::Migration
+  def self.up
+    add_index :watchers, [:user_id, :watchable_type], :name => :watchers_user_id_type
+  end
+
+  def self.down
+    remove_index :watchers, :name => :watchers_user_id_type
+  end
+end