X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8ee1351049ef1bb4d7b50d071b2a96154266d1d..7b37f4cb62fca5fec3d3d41eacf4601595519c4a:/db/migrate/025_add_end_time_to_changesets.rb diff --git a/db/migrate/025_add_end_time_to_changesets.rb b/db/migrate/025_add_end_time_to_changesets.rb index b87ce3fde..20d66719d 100644 --- a/db/migrate/025_add_end_time_to_changesets.rb +++ b/db/migrate/025_add_end_time_to_changesets.rb @@ -1,3 +1,5 @@ +require 'lib/migrate' + class AddEndTimeToChangesets < ActiveRecord::Migration def self.up # swap the boolean closed-or-not for a time when the changeset will @@ -7,8 +9,8 @@ class AddEndTimeToChangesets < ActiveRecord::Migration # it appears that execute will only accept string arguments, so # this is an ugly, ugly hack to get some sort of mysql/postgres # independence. now i have to go wash my brain with bleach. - execute("update changesets set closed_at=(now()-'1 hour') where open=(1=0)") - execute("update changesets set closed_at=(now()+'1 hour') where open=(1=1)") + execute("update changesets set closed_at=(now()-#{interval_constant('1 hour')}) where open=(1=0)") + execute("update changesets set closed_at=(now()+#{interval_constant('1 hour')}) where open=(1=1)") # remove the open column as it is unnecessary now and denormalises # the table.