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|
19 hash.each_value do |node_array|
21 node_array.each do |node|
22 temp_old_node = TempOldNode.new
23 temp_old_node.id = node.id
24 temp_old_node.latitude = node.latitude
25 temp_old_node.longitude = node.longitude
26 temp_old_node.user_id = node.user_id
27 temp_old_node.visible = node.visible
28 temp_old_node.timestamp = node.timestamp
29 temp_old_node.tile = node.tile
30 temp_old_node.version = n
31 temp_old_node.save! || raise