Makes migration scripts load tickets in batches (#4011).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2923 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2009-10-11 10:12:07 +00:00
parent 0ac07afc67
commit 0b3e3471b0
2 changed files with 2 additions and 2 deletions

View File

@ -314,7 +314,7 @@ task :migrate_from_mantis => :environment do
Issue.destroy_all Issue.destroy_all
issues_map = {} issues_map = {}
keep_bug_ids = (Issue.count == 0) keep_bug_ids = (Issue.count == 0)
MantisBug.find(:all, :order => 'id ASC').each do |bug| MantisBug.find_each(:batch_size => 200) do |bug|
next unless projects_map[bug.project_id] && users_map[bug.reporter_id] next unless projects_map[bug.project_id] && users_map[bug.reporter_id]
i = Issue.new :project_id => projects_map[bug.project_id], i = Issue.new :project_id => projects_map[bug.project_id],
:subject => encode(bug.summary), :subject => encode(bug.summary),

View File

@ -458,7 +458,7 @@ namespace :redmine do
# Tickets # Tickets
print "Migrating tickets" print "Migrating tickets"
TracTicket.find(:all, :order => 'id ASC').each do |ticket| TracTicket.find_each(:batch_size => 200) do |ticket|
print '.' print '.'
STDOUT.flush STDOUT.flush
i = Issue.new :project => @target_project, i = Issue.new :project => @target_project,