Class: AddMinutesToPunches

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/db/migrate/03_add_minutes_to_punches.rb

Class Method Summary collapse

Class Method Details

.downObject



9
10
11
# File 'lib/db/migrate/03_add_minutes_to_punches.rb', line 9

def self.down
  remove_column :punches, :minutes, :integer
end

.upObject



2
3
4
5
6
7
# File 'lib/db/migrate/03_add_minutes_to_punches.rb', line 2

def self.up
  add_column :punches, :minutes, :integer, :default => 0
  Punch.all.each do |p|
    p.save!
  end
end