Commit 610f0dc52643c5e16108753714e4a0de72d4fa3c

Authored by Marcin Ciunelis
1 parent 24e4fe69
Exists in master and in 1 other branch production

verbose migration

db/migrate/20121003223358_extract_backtraces.rb
1 class ExtractBacktraces < Mongoid::Migration 1 class ExtractBacktraces < Mongoid::Migration
2 def self.up 2 def self.up
  3 + say "Please it could take long time (hours if you have many Notices)"
3 Notice.unscoped.all.each do |notice| 4 Notice.unscoped.all.each do |notice|
4 backtrace = Backtrace.find_or_create(:raw => notice['backtrace']) 5 backtrace = Backtrace.find_or_create(:raw => notice['backtrace'])
5 notice.backtrace = backtrace 6 notice.backtrace = backtrace
6 notice['backtrace'] = nil 7 notice['backtrace'] = nil
7 notice.save! 8 notice.save!
8 end 9 end
  10 + say "run `db.repairDatabase()` (in mongodb console) to recover deleted space"
9 end 11 end
10 12
11 def self.down 13 def self.down