Class: CreateViews

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/how_are_we_doing/install/templates/db/migrate/create_views.rb

Class Method Summary collapse

Class Method Details

.downObject



13
14
15
# File 'lib/generators/how_are_we_doing/install/templates/db/migrate/create_views.rb', line 13

def self.down
  drop_table :views
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/how_are_we_doing/install/templates/db/migrate/create_views.rb', line 2

def self.up
  create_table :views do |t|
    t.references :viewable, :polymorphic => true
    t.references :user
    t.timestamps
  end
  
  add_index :views, [:viewable_id, :viewable_type]
  add_index :views, :user_id
end