Import of Mantis Data to Redmine
I know it seems the import of MANTIS or TRAC data is not anymore supported. But as I wanted to change from MANTIS to Redmine, I did not want to loose my existing data.
So if anybody has the same problem, maybe he can manage it like I did:
So based on the latest description for importing MANTIS data in https://www.redmine.org/boards/2/topics/54134?r=54174#message-54174, I managed to import my existing MANTIS database items to Redmine with the following steps by modifying the existing but not anymore supported rake script that was in the distribution:
The redmine source code is under /user/share/redmine
It is very useful to have access to the sql data via phpmyadmin. there I was able to check which table names and fields arte used in redmine and MANTIS.
Write access to store files has to be granted in: /usr/share/redmine/instances/default/files
otherwise the script will issue an error :
"Permission denied @ dir_s_mkdir - /usr/share/redmine/instances/default/files/"
if the script fails by any reason (which it did a lot when I was adjusting it), there may be already from MANTIS imported items to the Redmine sql database. The scripts will stop, if there are entries in "email_addresses" (in the sql db).
I have then simply manually deleted the sql entries of "email_addresses", which allows to run the script again.
To insert the default configuration data in database, you could run the following command:
RAILS_ENV=production bundle exec rake redmine:load_default_data
Note: this may not delete existing data !
Allow to import Bugs / Issues time stamps:
In the script, there is called the ISSUE.new function which normally sets the updated_on and created_on fields to the current time.
When importing the MANTIS Bugs, of course one wants to keep the Bugs time.
To do this, in /usr/share/redmine/app/models/issue.rb I have temporarily modified the code by just commenting out these function :
print "Dummy" #KH indicate this function is called
#if @current_journal || changed? # self.updated_on = current_time_from_proper_timezone # if new_record? # self.created_on = updated_on # end
The Mantis import script can be started from folder /user/share/redmine
with: bundle exec rake redmine:migrate_from_mantis RAILS_ENV="production"
The "bundle exec" is a worklaround for errors issued because of the outdated script. There may be a more clever way, but I am not an expert on this and it worked for me like that.
Below is my modified script. I have modified the following things:
all time entries like "user.last_visit", "user.date_created", etc. , have been modified to
The categories are stored first, before importing the projects. A mapping is made, which category name is which id.
Later when migrating the bugs, the categories can be assigned to a project.
some tabel naming was wrong like "category_id" instead of "category"
and "category.name" instead "category.category"
migrate_from_mantis.rake - modified migration script KH (21.7 KB)
RE: Import of Mantis Data to Redmine - Added by adrian perez over 1 year ago
I will try this, thank you very much!