impressionist/test_app/db/migrate/20111127195013_create_impre...

38 lines
1.7 KiB
Ruby
Raw Normal View History

2011-11-27 19:51:51 +00:00
class CreateImpressionsTable < ActiveRecord::Migration
def self.up
create_table :impressions, :force => true do |t|
t.string :impressionable_type
t.integer :impressionable_id
t.integer :user_id
t.string :controller_name
t.string :action_name
t.string :view_name
t.string :request_hash
t.string :ip_address
2012-03-06 23:24:00 +00:00
t.string :session_hash
t.text :message
t.text :referrer
2011-11-27 19:51:51 +00:00
t.timestamps
end
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
2011-11-27 19:51:51 +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
add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false
2011-11-27 19:51:51 +00:00
add_index :impressions, :user_id
end
def self.down
remove_index :impressions, :name => :poly_request_index
remove_index :impressions, :name => :poly_ip_index
remove_index :impressions, :name => :poly_session_index
2011-11-27 19:51:51 +00:00
remove_index :impressions, :name => :controlleraction_request_index
remove_index :impressions, :name => :controlleraction_ip_index
remove_index :impressions, :name => :controlleraction_session_index
2011-11-27 19:51:51 +00:00
remove_index :impressions, :user_id
2011-11-27 19:51:51 +00:00
drop_table :impressions
end
end