Commit 7798d7fd9447c20f440e9cfaf49544fe28fdeed8
1 parent
40453cc3
Exists in
master
and in
1 other branch
do not trigger email notifications during migration
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
db/migrate/20110422152027_move_notices_to_separate_collection.rb
... | ... | @@ -6,10 +6,14 @@ class MoveNoticesToSeparateCollection < Mongoid::Migration |
6 | 6 | errs.each do |err| |
7 | 7 | next unless err['notices'] |
8 | 8 | e = Err.find(err['_id']) |
9 | + # disable email notifications | |
10 | + old_notify = e.app.notify_on_errs? | |
11 | + e.app.update_attribute(:notify_on_errs, false) | |
9 | 12 | puts "Copying notices for Err #{err['_id']}" |
10 | 13 | err['notices'].each do |notice| |
11 | 14 | e.notices.create!(notice) |
12 | 15 | end |
16 | + e.app.update_attribute(:notify_on_errs, old_notify) | |
13 | 17 | mongo_db.collection("errs").update({ "_id" => err['_id']}, { "$unset" => { "notices" => 1}}) |
14 | 18 | end |
15 | 19 | Rake::Task["errbit:db:update_notices_count"].invoke | ... | ... |