Commit a8faf3a17e8e687a7afc42873a1e77235e8035ca
Exists in
master
and in
1 other branch
Merge pull request #559 from shingara/tickets/557
Fix environment value of problem with invalid problem already save
Showing
2 changed files
with
11 additions
and
2 deletions
Show diff stats
db/migrate/20110422152027_move_notices_to_separate_collection.rb
@@ -20,6 +20,13 @@ class MoveNoticesToSeparateCollection < Mongoid::Migration | @@ -20,6 +20,13 @@ 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 | + ( | ||
24 | + Problem.where(:environment => '') | | ||
25 | + Problem.where(:environment => nil) | | ||
26 | + Problem.where(:environment => {}) | ||
27 | + ).each {|pr| | ||
28 | + pr.update_attributes(:environment => 'old') | ||
29 | + } | ||
23 | Rake::Task["errbit:db:update_notices_count"].invoke | 30 | Rake::Task["errbit:db:update_notices_count"].invoke |
24 | Rake::Task["errbit:db:update_problem_attrs"].invoke | 31 | Rake::Task["errbit:db:update_problem_attrs"].invoke |
25 | end | 32 | end |
db/migrate/20121005142110_regenerate_err_fingerprints.rb
@@ -10,8 +10,10 @@ class RegenerateErrFingerprints < Mongoid::Migration | @@ -10,8 +10,10 @@ class RegenerateErrFingerprints < Mongoid::Migration | ||
10 | :environment => err.environment, | 10 | :environment => err.environment, |
11 | :api_key => err.app.api_key | 11 | :api_key => err.app.api_key |
12 | } | 12 | } |
13 | - fingerprint = Digest::SHA1.hexdigest(fingerprint_source.to_s) | ||
14 | - err.update_attribute(:fingerprint, fingerprint) | 13 | + err.update_attribute( |
14 | + :fingerprint, | ||
15 | + Fingerprint.generate(err.notices.first, err.app.api_key) | ||
16 | + ) | ||
15 | end | 17 | end |
16 | end | 18 | end |
17 | end | 19 | end |