2
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/generators/punching_bag/templates/create_punches_table.rb', line 2
def self.up
create_table :punches do |t|
t.integer :punchable_id, :null => false
t.string :punchable_type, :null => false, :limit => 20
t.datetime :starts_at, :null => false
t.datetime :ends_at, :null => false
t.datetime :average_time, :null => false
t.integer :hits, :null => false, :default=>1
end
add_index :punches, [:punchable_type, :punchable_id], :name => :punchable_index, :unique => false
add_index :punches, :average_time, :unique => false
end
|