Commit c746513ab7f3ccc17519627f2bca121fdd418c46
Exists in
master
and in
1 other branch
Merge pull request #541 from skorth/master
Fix issue #538
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
db/migrate/20121003223358_extract_backtraces.rb
@@ -2,6 +2,7 @@ class ExtractBacktraces < Mongoid::Migration | @@ -2,6 +2,7 @@ class ExtractBacktraces < Mongoid::Migration | ||
2 | def self.up | 2 | def self.up |
3 | say "It could take long time (hours if you have many Notices)" | 3 | say "It could take long time (hours if you have many Notices)" |
4 | Notice.unscoped.all.each do |notice| | 4 | Notice.unscoped.all.each do |notice| |
5 | + next if notice.backtrace.present? || notice['backtrace'].nil? | ||
5 | backtrace = Backtrace.find_or_create(:raw => notice['backtrace'] || []) | 6 | backtrace = Backtrace.find_or_create(:raw => notice['backtrace'] || []) |
6 | notice.backtrace = backtrace | 7 | notice.backtrace = backtrace |
7 | notice['backtrace'] = nil | 8 | notice['backtrace'] = nil |
@@ -12,4 +13,4 @@ class ExtractBacktraces < Mongoid::Migration | @@ -12,4 +13,4 @@ class ExtractBacktraces < Mongoid::Migration | ||
12 | 13 | ||
13 | def self.down | 14 | def self.down |
14 | end | 15 | end |
15 | -end | 16 | -end |
17 | +end | ||
16 | \ No newline at end of file | 18 | \ No newline at end of file |