Permalink
Browse files

Add compound index on impressionable_type, message, impressionable_id

  • Loading branch information...
1 parent 63ea4d5 commit a773a4d366ba0eb5c5f334103f682ce15fa52056 @AdamFerguson AdamFerguson committed Apr 3, 2012
@@ -14,6 +14,7 @@ def self.up
t.text :referrer
t.timestamps
end
+ add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :ip_address], :name => "poly_ip_index", :unique => false
add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false
@@ -0,0 +1,9 @@
+class Version04UpdateImpressionsTable < ActiveRecord::Migration
+ def self.up
+ add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false
+ end
+
+ def self.down
+ remove_column :impressions, :impressionable_type_message_index
+ end
+end

1 comment on commit a773a4d

@johnmcaliley
Member

@AdamFerguson can you take a look at this issue if you have a minute:

#63

I think it is related to this commit

Please sign in to comment.