mirror of
https://github.com/fspc/bike-database.git
synced 2026-09-16 08:31:39 -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
|
||||
+3
-2
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151219225720) do
|
||||
ActiveRecord::Schema.define(version: 20151230021120) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -66,11 +66,12 @@ ActiveRecord::Schema.define(version: 20151219225720) do
|
||||
t.boolean "bike_fixed"
|
||||
t.integer "number_of_calls"
|
||||
t.boolean "application_voided"
|
||||
t.date "pickup_date"
|
||||
t.date "pickup_date_bkp"
|
||||
t.string "volunteer_at_pickup"
|
||||
t.float "weight"
|
||||
t.float "height"
|
||||
t.datetime "application_date"
|
||||
t.datetime "pickup_date"
|
||||
end
|
||||
|
||||
add_index "clients", ["agency_id"], name: "index_clients_on_agency_id", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user