mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 16:41:38 -04:00
lk | changes type of date stored for client pickup
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user