]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_node.rb
Fixing the migration so that it will better match the live databetter.
[rails.git] / app / models / old_node.rb
index d4d9f177575ab3e23b131afd6f93567cbe9fbb09..91b5a1a8ea9024519a8372bf5b43a5220a9fdf04 100644 (file)
@@ -1,5 +1,6 @@
 class OldNode < ActiveRecord::Base
   include GeoRecord
 class OldNode < ActiveRecord::Base
   include GeoRecord
+  include ConsistencyValidations
 
   set_table_name 'nodes'
   
 
   set_table_name 'nodes'
   
@@ -38,6 +39,7 @@ class OldNode < ActiveRecord::Base
     el1['id'] = self.id.to_s
     el1['lat'] = self.lat.to_s
     el1['lon'] = self.lon.to_s
     el1['id'] = self.id.to_s
     el1['lat'] = self.lat.to_s
     el1['lon'] = self.lon.to_s
+    el1['changeset'] = self.changeset.id.to_s
     el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
 
     self.tags.each do |k,v|
     el1['user'] = self.changeset.user.display_name if self.changeset.user.data_public?
 
     self.tags.each do |k,v|
@@ -59,7 +61,7 @@ class OldNode < ActiveRecord::Base
     clear_aggregation_cache
     clear_association_cache
     #ok from here
     clear_aggregation_cache
     clear_association_cache
     #ok from here
-    @attributes.update(OldNode.find(:first, :conditions => ['id = ? AND timestamp = ?', self.id, self.timestamp]).instance_variable_get('@attributes'))
+    @attributes.update(OldNode.find(:first, :conditions => ['id = ? AND timestamp = ? AND version = ?', self.id, self.timestamp, self.version]).instance_variable_get('@attributes'))
    
     self.tags.each do |k,v|
       tag = OldNodeTag.new
    
     self.tags.each do |k,v|
       tag = OldNodeTag.new