Commit f7f4d6b82f593a3e7cb9e5c1f25f725bd288532d
1 parent
df54a697
Exists in
master
and in
1 other branch
Fix Problem with environement == {} too in old migration
See #557
Showing
1 changed file
with
5 additions
and
4 deletions
Show diff stats
db/migrate/20110422152027_move_notices_to_separate_collection.rb
@@ -20,10 +20,11 @@ class MoveNoticesToSeparateCollection < Mongoid::Migration | @@ -20,10 +20,11 @@ class MoveNoticesToSeparateCollection < Mongoid::Migration | ||
20 | e.app.update_attribute(:notify_on_errs, old_notify) | 20 | e.app.update_attribute(:notify_on_errs, old_notify) |
21 | mongo_db.collection("errs").update({ "_id" => err['_id']}, { "$unset" => { "notices" => 1}}) | 21 | mongo_db.collection("errs").update({ "_id" => err['_id']}, { "$unset" => { "notices" => 1}}) |
22 | end | 22 | end |
23 | - Problem.where(:environment => '').each {|pr| | ||
24 | - pr.update_attributes(:environment => 'old') | ||
25 | - } | ||
26 | - Problem.where(:environment => nil).each {|pr| | 23 | + ( |
24 | + Problem.where(:environment => '') | | ||
25 | + Problem.where(:environment => nil) | | ||
26 | + Problem.where(:environment => {}) | ||
27 | + ).each {|pr| | ||
27 | pr.update_attributes(:environment => 'old') | 28 | pr.update_attributes(:environment => 'old') |
28 | } | 29 | } |
29 | Rake::Task["errbit:db:update_notices_count"].invoke | 30 | Rake::Task["errbit:db:update_notices_count"].invoke |