Add user_id + created_at index to changesets
authorTom Hughes <tom@compton.nu>
Thu, 13 May 2010 17:16:31 +0000 (18:16 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 13 May 2010 17:16:31 +0000 (18:16 +0100)
Browsing changesets for a user will be much faster if we can get the
user's changesets in date order.

db/migrate/20100513171259_add_user_date_index_to_changeset.rb [new file with mode: 0644]

diff --git a/db/migrate/20100513171259_add_user_date_index_to_changeset.rb b/db/migrate/20100513171259_add_user_date_index_to_changeset.rb
new file mode 100644 (file)
index 0000000..22e1f08
--- /dev/null
@@ -0,0 +1,9 @@
+class AddUserDateIndexToChangeset < ActiveRecord::Migration
+  def self.up
+    add_index :changesets, [:user_id, :created_at], :name => "changesets_user_id_created_at_idx"
+  end
+
+  def self.down
+    remove_index :changesets, [:user_id, :created_at], :name => "changesets_user_id_created_at_idx"
+  end
+end