Class: CreateImpressionsTable

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/active_record/templates/create_impressions_table.rb

Class Method Summary collapse

Class Method Details

.downObject



29
30
31
# File 'lib/generators/active_record/templates/create_impressions_table.rb', line 29

def self.down
  drop_table :impressions
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/active_record/templates/create_impressions_table.rb', line 2

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
    t.string :session_hash
    t.text :message
    t.text :referrer
    t.text :params
    t.timestamps
  end
  add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false, :length => {:message => 255 }
  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
  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
  add_index :impressions, [:impressionable_type, :impressionable_id, :params], :name => "poly_params_request_index", :unique => false
  add_index :impressions, :user_id
end