@@ -308,7 +308,8 task :migrate_from_mantis => :environment do | |||
|
308 | 308 | print "Migrating bugs" |
|
309 | 309 | Issue.destroy_all |
|
310 | 310 | issues_map = {} |
|
311 | MantisBug.find(:all).each do |bug| | |
|
311 | keep_bug_ids = (Issue.count == 0) | |
|
312 | MantisBug.find(:all, :order => 'id ASC').each do |bug| | |
|
312 | 313 | next unless projects_map[bug.project_id] && users_map[bug.reporter_id] |
|
313 | 314 | i = Issue.new :project_id => projects_map[bug.project_id], |
|
314 | 315 | :subject => encode(bug.summary), |
@@ -321,6 +322,7 task :migrate_from_mantis => :environment do | |||
|
321 | 322 | i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank? |
|
322 | 323 | i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS |
|
323 | 324 | i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG) |
|
325 | i.id = bug.id if keep_bug_ids | |
|
324 | 326 | next unless i.save |
|
325 | 327 | issues_map[bug.id] = i.id |
|
326 | 328 | print '.' |
@@ -357,6 +359,9 task :migrate_from_mantis => :environment do | |||
|
357 | 359 | i.add_watcher(User.find_by_id(users_map[monitor.user_id])) |
|
358 | 360 | end |
|
359 | 361 | end |
|
362 | ||
|
363 | # update issue id sequence if needed (postgresql) | |
|
364 | Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!') | |
|
360 | 365 | puts |
|
361 | 366 | |
|
362 | 367 | # Bug relationships |
General Comments 0
You need to be logged in to leave comments.
Login now