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
|
t = Time.now
|
||||||
self.timestamp = t
|
self.timestamp = t
|
||||||
self.save!
|
self.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
WayTag.transaction do
|
||||||
tags = self.tags
|
tags = self.tags
|
||||||
|
|
||||||
WayTag.delete_all(['id = ?', self.id])
|
WayTag.delete_all(['id = ?', self.id])
|
||||||
|
@ -159,7 +161,9 @@ class Way < ActiveRecord::Base
|
||||||
tag.id = self.id
|
tag.id = self.id
|
||||||
tag.save!
|
tag.save!
|
||||||
end
|
end
|
||||||
|
done
|
||||||
|
|
||||||
|
WaySegment.transaction do
|
||||||
segs = self.segs
|
segs = self.segs
|
||||||
|
|
||||||
WaySegment.delete_all(['id = ?', self.id])
|
WaySegment.delete_all(['id = ?', self.id])
|
||||||
|
@ -173,11 +177,11 @@ class Way < ActiveRecord::Base
|
||||||
seg.save!
|
seg.save!
|
||||||
i += 1
|
i += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
old_way = OldWay.from_way(self)
|
|
||||||
old_way.timestamp = t
|
|
||||||
old_way.save_with_dependencies!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
old_way = OldWay.from_way(self)
|
||||||
|
old_way.timestamp = t
|
||||||
|
old_way.save_with_dependencies!
|
||||||
end
|
end
|
||||||
|
|
||||||
def preconditions_ok?
|
def preconditions_ok?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue