2 desc 'Adds a version number to the nodes table'
4 require File.dirname(__FILE__) + '/../../config/environment'
8 id_max = OldNode.find(:first, :order => 'id desc').id
10 while offset < (id_max + increment)
13 # should be offsetting not selecting
14 OldNode.find(:all, :limit => increment, :offset => offset, :order => 'timestamp').each do |node|
21 hash.each_value do |node_array|
23 node_array.each do |node|
24 temp_old_node = TempOldNode.new
25 temp_old_node.id = node.id
26 temp_old_node.latitude = node.latitude
27 temp_old_node.longitude = node.longitude
28 temp_old_node.user_id = node.user_id
29 temp_old_node.visible = node.visible
30 temp_old_node.timestamp = node.timestamp
31 temp_old_node.tile = node.tile
32 temp_old_node.version = n
33 temp_old_node.save! || fail