Commit 218576c5 authored by Ponder Stibbons's avatar Ponder Stibbons

#199, updated outdated comment

parent 648938f7
......@@ -7,9 +7,10 @@ class ChangeConferenceDayStartType < ActiveRecord::Migration
ends << Time.at(conference.day_end).hour
end
# We need to use a two-step process, because psql is not able
# to cast the default value to integer and therefore won't to
# the type change.
# At least PostgreSQL is not willing to change the type from time to integer
# without telling it how to do the conversion. To stay database independent,
# we create a new column, remove the old one and then rename the new column
# to the old columns name in the hope of staying database independent.
add_column :conferences, :new_day_start, :integer, default: 8, null: false
remove_column :conferences, :day_start
rename_column :conferences, :new_day_start, :day_start
......@@ -18,7 +19,7 @@ class ChangeConferenceDayStartType < ActiveRecord::Migration
remove_column :conferences, :day_end
rename_column :conferences, :new_day_end, :day_end
# do change
# do conversion
Conference.all.each_with_index do |conference,i|
conference.update_attribute :day_start, starts[i]
conference.update_attribute :day_end, ends[i]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment