Sha256: 9a404c9b4f2b1270e8d7132c03d5d28b5c7f2c919fcce10b3c10e81dab46c61e

Contents?: true

Size: 707 Bytes

Versions: 8

Compression:

Stored size: 707 Bytes

Contents

class CreatePunchesTable < ActiveRecord::Migration
  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

  def self.down
    remove_index :punches, :name => :punchable_index
    remove_index :punches, :average_time
    drop_table :punches
  end
end 

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
punching_bag-0.3.3 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.3.2 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.3.1 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.3.0 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.2.0 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.1.2 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.1.1 lib/generators/punching_bag/templates/create_punches_table.rb
punching_bag-0.1.0 lib/generators/punching_bag/templates/create_punches_table.rb