Class: CreateVotes

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

Class Method Summary collapse

Class Method Details

.downObject



17
18
19
# File 'lib/generators/templates/create_votes.rb', line 17

def self.down
  drop_table :votes
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/templates/create_votes.rb', line 2

def self.up
  create_table :votes, :force => true do |t|
    t.string :votable_type
    t.integer :votable_id
    t.integer :value
    t.integer :user_id
    t.string :ip
    t.timestamps
  end
  add_index :votes, :votable_type
  add_index :votes, :votable_id
  add_index :votes, :user_id
  add_index :votes, :ip
end