Improve migration/rollback logic for attachments
This commit is contained in:
parent
61d77a042d
commit
3524a618d6
2 changed files with 14 additions and 6 deletions
|
@ -22,10 +22,14 @@ module Projects
|
||||||
@new_disk_path = project.disk_path
|
@new_disk_path = project.disk_path
|
||||||
|
|
||||||
result = move_folder!(origin, target)
|
result = move_folder!(origin, target)
|
||||||
|
|
||||||
|
if result
|
||||||
project.save!
|
project.save!
|
||||||
|
|
||||||
if result && block_given?
|
yield if block_given?
|
||||||
yield
|
else
|
||||||
|
# Rollback changes
|
||||||
|
project.rollback!
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
|
@ -17,10 +17,14 @@ module Projects
|
||||||
@new_disk_path = FileUploader.base_dir(project)
|
@new_disk_path = FileUploader.base_dir(project)
|
||||||
|
|
||||||
result = move_folder!(origin, target)
|
result = move_folder!(origin, target)
|
||||||
|
|
||||||
|
if result
|
||||||
project.save!
|
project.save!
|
||||||
|
|
||||||
if result && block_given?
|
yield if block_given?
|
||||||
yield
|
else
|
||||||
|
# Rollback changes
|
||||||
|
project.rollback!
|
||||||
end
|
end
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue