From c9aedbec5d77d71b4f33e6db0291150e29a84912 Mon Sep 17 00:00:00 2001 From: friflaj Date: Fri, 8 Oct 2010 13:53:14 +0200 Subject: [PATCH] Don't break on nested tasks --- db/migrate/015_order_tasks_using_tree.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/db/migrate/015_order_tasks_using_tree.rb b/db/migrate/015_order_tasks_using_tree.rb index 55a3053d82..a71e47f639 100644 --- a/db/migrate/015_order_tasks_using_tree.rb +++ b/db/migrate/015_order_tasks_using_tree.rb @@ -3,7 +3,12 @@ class OrderTasksUsingTree < ActiveRecord::Migration last_task = {} ActiveRecord::Base.transaction do Task.find(:all, :conditions => "not parent_id is NULL", :order => "project_id ASC, parent_id ASC, position ASC").each do |t| - t.move_after last_task[t.parent_id] if last_task[t.parent_id] + begin + t.move_after last_task[t.parent_id] if last_task[t.parent_id] + rescue + # nested tasks break this migrations. Task order not that + # big a deal, proceed + end last_task[t.parent_id] = t.id end