Commit af91f5bd0448195ac87426e51fb945d14fccc5d9

Authored by Gerrit Riessen
1 parent 3851c29b
Exists in master and in 1 other branch production

Fixed migration from Err to Problem, so that

* old links to errors will keep working (problems have the same id's as original err)
* problems are marked resolved if the original err was resolved.
* if the err had an issue_link, then the new problem also has that link.
db/migrate/20110905134638_link_errs_to_problems.rb
... ... @@ -12,7 +12,11 @@ class LinkErrsToProblems < Mongoid::Migration
12 12 puts "==== Create a Problem for each Err..."
13 13 Err.all.each do |err|
14 14 if err['app_id'] && app = App.where(:_id => err['app_id']).first
15   - err.problem = app.problems.create
  15 + err.problem = app.problems.create(:_id => err.id)
  16 + err.problem.resolve! if err.resolved
  17 + # don't bother checking err for issue link, if it ain't got one the NoMethodError
  18 + # is raised, else this works fine.
  19 + err.problem.update_attribute(:issue_link, err.issue_link) rescue NoMethodError
16 20 err.save
17 21 end
18 22 end
... ...