X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..ef7f3d800cbdd49b692df10d312e5fd880e2e938:/lib/tasks/add_version_to_nodes.rake diff --git a/lib/tasks/add_version_to_nodes.rake b/lib/tasks/add_version_to_nodes.rake index 22762ef2e..c0fac49b7 100644 --- a/lib/tasks/add_version_to_nodes.rake +++ b/lib/tasks/add_version_to_nodes.rake @@ -10,12 +10,12 @@ namespace 'db' do while offset < (id_max + increment) hash = {} - #should be offsetting not selecting + # should be offsetting not selecting OldNode.find(:all, :limit => increment, :offset => offset, :order => 'timestamp').each do |node| - if hash[node.id].nil? - hash[node.id] = [] - end - hash[node.id] << node + if hash[node.id].nil? + hash[node.id] = [] + end + hash[node.id] << node end hash.each_value do |node_array| @@ -30,8 +30,8 @@ namespace 'db' do temp_old_node.timestamp = node.timestamp temp_old_node.tile = node.tile temp_old_node.version = n - temp_old_node.save! || raise - n +=1 + temp_old_node.save! || fail + n += 1 end end offset += increment