--- migrate_from_mantis.rake.original 2014-11-28 14:30:15.309721572 +0100 +++ migrate_from_mantis.rake.working2 2014-11-28 14:14:47.161757970 +0100 @@ -20,6 +20,7 @@ require 'active_record' require 'iconv' if RUBY_VERSION < '1.9' require 'pp' +require 'date' namespace :redmine do task :migrate_from_mantis => :environment do @@ -136,7 +137,7 @@ end class MantisCategory < ActiveRecord::Base - self.table_name = :mantis_project_category_table + self.table_name = :mantis_category_table end class MantisProjectUser < ActiveRecord::Base @@ -313,10 +314,10 @@ :subject => encode(bug.summary), :description => encode(bug.bug_text.full_description), :priority => PRIORITY_MAPPING[bug.priority] || DEFAULT_PRIORITY, - :created_on => bug.date_submitted, - :updated_on => bug.last_updated + :created_on => Time.at(bug.date_submitted).to_datetime, + :updated_on => Time.at(bug.last_updated).to_datetime i.author = User.find_by_id(users_map[bug.reporter_id]) - i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category[0,30]) unless bug.category.blank? + i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category_id[0]) unless bug.category_id.blank? i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank? i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG) @@ -337,7 +338,7 @@ bug.bug_notes.each do |note| next unless users_map[note.reporter_id] n = Journal.new :notes => encode(note.bug_note_text.note), - :created_on => note.date_submitted + :created_on => Time.at(note.date_submitted).to_datetime n.user = User.find_by_id(users_map[note.reporter_id]) n.journalized = i n.save @@ -345,7 +346,8 @@ # Bug files bug.bug_files.each do |file| - a = Attachment.new :created_on => file.date_added + a = Attachment.new + a = Attachment.new :created_on => Time.at(file.date_added).to_datetime a.file = file a.author = User.first a.container = i