Import of Mantis Data to Redmine
Added by Klaus Heerlein almost 4 years ago
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:
at /usr/share/redmine/lib/tasks/migrate_from_mantis.rake
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/"
Note:
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 :
@
def force_updated_on_change
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
#end
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
Time.at().to_datetime
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 (21.7 KB) migrate_from_mantis.rake | modified migration script KH |
Replies (4)
RE: Import of Mantis Data to Redmine - Added by adrian perez over 3 years ago
I will try this, thank you very much!
RE: Import of Mantis Data to Redmine - Added by ken hsu 4 months ago
Hello Klaus and Adrian
I am new to migrating from Mantis to Redmine. May I have the instruction guide or migration procedures if you don’t mind sharing? Any comments or suggestions are welcome. Thank you.
########
Environment:
Redmine version 5.1.2.stable
Ruby version 3.2.3-p157 (2024-01-18) [x86_64-linux]
Rails version 6.1.7.7
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
Redmine settings:
Redmine theme Default
SCM:
Subversion 1.14.2
Mercurial 6.3.2
Bazaar 3.3.2
Git 2.39.2
Filesystem
Redmine plugins:
no plugin installed
RE: Import of Mantis Data to Redmine - Added by Klaus Heerlein 4 months ago
Hi,
sorry all I have is documented in the post above. It is been a while since I did it.
So you can try to follow the steps a described above. Other than that I may not be able to help any further.
I hope you manage to do it.
RE: Import of Mantis Data to Redmine - Added by ken hsu 4 months ago
Klaus Heerlein wrote in RE: Import of Mantis Data to Redmine:
Hi,
sorry all I have is documented in the post above. It is been a while since I did it.
So you can try to follow the steps a described above. Other than that I may not be able to help any further.
I hope you manage to do it.
Hello Klaus,
thank you for replying, Will try it once available. Many thanks~~~