Bike database interface
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
516 B

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