Louis Knapp
9 years ago
5 changed files with 31 additions and 6 deletions
@ -0,0 +1,17 @@ |
|||
class ChangePickupDateToDateTime < ActiveRecord::Migration |
|||
def up |
|||
add_column :clients, :pickup_datetime, :datetime |
|||
Client.all.to_a.each{ |client| |
|||
if client.pickup_date |
|||
client.update_attribute(:pickup_datetime, client.pickup_date) |
|||
end |
|||
} |
|||
rename_column :clients, :pickup_date, :pickup_date_bkp |
|||
rename_column :clients, :pickup_datetime, :pickup_date |
|||
end |
|||
|
|||
def down |
|||
remove_column :clients, :pickup_date |
|||
rename_column :clients, :pickup_date_bkp, :pickup_date |
|||
end |
|||
end |
Loading…
Reference in new issue