2020-07-20 13:35:41 +00:00
|
|
|
class CreateImpressionsTable < ActiveRecord::Migration[4.2]
|
2011-03-07 04:22:39 +00:00
|
|
|
def self.up
|
|
|
|
add_column :impressions, :session_hash, :string
|
|
|
|
remove_index :impressions, :name => :poly_index
|
|
|
|
remove_index :impressions, :name => :controlleraction_index
|
|
|
|
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
|
2012-03-06 21:42:28 +00:00
|
|
|
add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false
|
2011-03-07 04:22:39 +00:00
|
|
|
add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false
|
|
|
|
add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false
|
2012-03-06 21:42:28 +00:00
|
|
|
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
|
|
|
|
|
2011-03-07 04:22:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
|
|
|
remove_column :impressions, :session_hash
|
|
|
|
remove_index :impressions, :name => :poly_request_index
|
|
|
|
remove_index :impressions, :name => :poly_ip_index
|
2012-03-06 21:42:28 +00:00
|
|
|
remove_index :impressions, :name => :poly_session_index
|
2011-03-07 04:22:39 +00:00
|
|
|
remove_index :impressions, :name => :controlleraction_request_index
|
|
|
|
remove_index :impressions, :name => :controlleraction_ip_index
|
2012-03-06 21:42:28 +00:00
|
|
|
remove_index :impressions, :name => :controlleraction_session_index
|
2011-03-07 04:22:39 +00:00
|
|
|
remove_index :impressions, :user_id
|
|
|
|
add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false
|
2012-03-06 21:42:28 +00:00
|
|
|
add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false
|
2011-03-07 04:22:39 +00:00
|
|
|
end
|
2012-03-06 21:42:28 +00:00
|
|
|
end
|