Commit 08f0e80fa674a64fec688e2a10b5609f2eb8fd50
1 parent
507edf53
Exists in
master
and in
1 other branch
Added 'puts' statements for each step of the migration.
Showing
1 changed file
with
5 additions
and
2 deletions
Show diff stats
db/migrate/20110905134638_link_errs_to_problems.rb
| 1 | 1 | class LinkErrsToProblems < Mongoid::Migration |
| 2 | 2 | def self.up |
| 3 | + puts "== Migrating from Errs to Problems..." | |
| 3 | 4 | |
| 4 | - # Copy err.klass to notice.klass | |
| 5 | + puts "==== Copy err.klass to notice.klass..." | |
| 5 | 6 | Notice.all.each do |notice| |
| 6 | 7 | if notice.err && (klass = notice.err['klass']) |
| 7 | 8 | notice.update_attribute(:klass, klass) |
| 8 | 9 | end |
| 9 | 10 | end |
| 10 | 11 | |
| 11 | - # Create a Problem for each Err | |
| 12 | + puts "==== Create a Problem for each Err..." | |
| 12 | 13 | Err.all.each do |err| |
| 13 | 14 | if err['app_id'] && app = App.where(:_id => err['app_id']).first |
| 14 | 15 | err.problem = app.problems.create |
| ... | ... | @@ -16,7 +17,9 @@ class LinkErrsToProblems < Mongoid::Migration |
| 16 | 17 | end |
| 17 | 18 | end |
| 18 | 19 | |
| 20 | + puts "==== Updating problem cached attributes..." | |
| 19 | 21 | Rake::Task["errbit:db:update_problem_attrs"].invoke |
| 22 | + puts "==== Updating notice counts..." | |
| 20 | 23 | Rake::Task["errbit:db:update_notices_count"].invoke |
| 21 | 24 | end |
| 22 | 25 | ... | ... |