Prevent large production databases from consuming all the RAM on the server and causing the migration to take forever. On a database with a large SVN repo, the Changesets ran for over two days before I gave up and cancelled it. After this change, the migration ran in under 10 minutes.
This commit is contained in:
parent
a107202a04
commit
b44dd085ac
@ -37,7 +37,7 @@ class BuildInitialJournalsForActsAsJournalized < ActiveRecord::Migration
|
|||||||
activity_type = p.activity_provider_options.keys.first
|
activity_type = p.activity_provider_options.keys.first
|
||||||
|
|
||||||
# Create initial journals
|
# Create initial journals
|
||||||
p.find(:all).each do |o|
|
p.find_each(:batch_size => 100 ) do |o|
|
||||||
# Using rescue and save! here because either the Journal or the
|
# Using rescue and save! here because either the Journal or the
|
||||||
# touched record could fail. This will catch either error and continue
|
# touched record could fail. This will catch either error and continue
|
||||||
begin
|
begin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user