Don't break on nested tasks

pull/6827/head
friflaj 14 years ago
parent a1ffa10f89
commit c9aedbec5d
  1. 5
      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|
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

Loading…
Cancel
Save