Svetozar Korytiak

Migrating Mantis Bugtracker data to Redmine in Linux Container

October 15, 2017

So you have decided to migrate your data from Mantis to Redmine, and after hitting the migratefrommantis rake file, an error occurred. No worries, this article will step you through most of the issues which can arise as problematic during the migration.

Databases

I suppose you use Mysql for Mantis and anything Mysql or SQLite for Redmine. Now lets hear it for some common errors you might encounter.

Ruby Version Manager

To make sure that you can change and update ruby version at will, install RVM. Then just run:

/bin/bash –login
rvm install 2.4.2 (or whatever the latest version is)
rvm use 2.4.2

NoMethodError

When you try to run the migration script(rake file: .../redmine/lib/tasks/migratefrommantis.rake) you may get the:

NoMethodError, custom field doesn't exist

This one is easy, just edit the 'migratefrommantis.rake' and change:

set\_inheritance\_column:none

line to:

inheritance\_column = :none

Mysql adapter 0.4.9 missing

Make sure to run:

apt install libmysql-dev
gem install mysql2

Red carpet error

For issues with red carpet run following commands:

gem update
gem install redcarpet rmagick
apt install imagemagick libmagickcore-dev libmagickwand-dev
gem install sqlite3 (if needed)
gem install nokogiri
bundle update
gem pristine -all

Psych error

If bundle update throws error that has to do with psych, just remove the reference:

rm -rf /usr/local/rvm/gems/ruby-2.4.2/gems/psych-2.2.4

If bundle install stops working, run:

gem install bundler

If mysql still throws an error, go to …/redmine/Gemfile and add:

gem “mysql2”, “~>0.4.9”

After that run bundle install.

At this point rake file should work, however there still might be an issue or two. If it fails at 'migrating projects..' and it has to do with bugtracker.mantisprojectcategory_table error, just go in to rake file and modify it like this:

vim /usr/share/redmine/lib/tasks/migrate\_from\_mantis
  1. Rename the mantisprojectcategorytable to mantiscategory_table if needed.
  2. Comment out the code with 'category'

And lastly, if you get the 'Migrating users aborted! ActiveRecord::RecordInvalid: Validation failed: Email has already been taken' kind of error for SQLite3, go ahead and remove those emails from the db this way:

sqlite3
.open /var/lib/dbconfig-common/sqlite3/redmine/instances/default/redmine_default (if thats where its located)
DELETE FROM email_addresses;
.quit

After that the migration should work! Enjoy your new Redmine!