Split the transaction used for ways so that we recover more cleanly
without leaving rubbish in the database.
This commit is contained in:
parent
ac98587141
commit
5fe7a5bbbc
1 changed files with 8 additions and 4 deletions
|
@ -147,7 +147,9 @@ class Way < ActiveRecord::Base
|
|||
t = Time.now
|
||||
self.timestamp = t
|
||||
self.save!
|
||||
end
|
||||
|
||||
WayTag.transaction do
|
||||
tags = self.tags
|
||||
|
||||
WayTag.delete_all(['id = ?', self.id])
|
||||
|
@ -159,7 +161,9 @@ class Way < ActiveRecord::Base
|
|||
tag.id = self.id
|
||||
tag.save!
|
||||
end
|
||||
done
|
||||
|
||||
WaySegment.transaction do
|
||||
segs = self.segs
|
||||
|
||||
WaySegment.delete_all(['id = ?', self.id])
|
||||
|
@ -173,12 +177,12 @@ class Way < ActiveRecord::Base
|
|||
seg.save!
|
||||
i += 1
|
||||
end
|
||||
end
|
||||
|
||||
old_way = OldWay.from_way(self)
|
||||
old_way.timestamp = t
|
||||
old_way.save_with_dependencies!
|
||||
end
|
||||
end
|
||||
|
||||
def preconditions_ok?
|
||||
return false if self.segs.empty?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue