2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/votes/migration.rb', line 2
def create_votes_table
create_table :votes do |t|
t.references :voteable, :polymorphic => true, :null => false
t.integer :points, :null => false, :default => 0
t.integer :power
t.integer :tone
t.integer :user_id, :null => false
t.timestamps
yield(t) if block_given?
end
add_index :votes, [:voteable_id, :voteable_type, :user_id], :unique => true
add_index :votes, [:user_id, :voteable_id, :voteable_type], :unique => true
end
|