Class: CreatePageViews

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/google_analytics_page_view_ranking/migration/templates/create_page_views.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/google_analytics_page_view_ranking/migration/templates/create_page_views.rb', line 2

def change
  create_table :page_views do |t|
    t.string :item_type
    t.integer :item_id
    t.string :period_type
    t.integer :page_view

    t.timestamps
  end

  add_index :page_views, [:item_type, :item_id, :period_type], unique: true
end