Migrating Mantis Bugtracker data to Redmine in Linux

So you have decided to migrate your data from Mantis to Redmine, and after hitting the migrate_from_mantis 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/migrate_from_mantis.rake) you may get the “NoMethodError, custom field doesnt exist”. This one is easy, just vim the 'migrate_from_mantis.rake' and change 'set_inheritance_column:none' line to 'inheritance_column = :none'.

Mysql adapter 0.4.9 missing

Make sure to install libmysql-dev first. Then try to: gem install mysql2

Red carpet error

For issues with red carpet run following commands:

                    gem update
                    gem install redcarpet
                    gem isntall 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.

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.mantis_project_category_table error, just in to rake file and modify it like this: Do the: vim /usr/share/redmine/lib/tasks/migrate_from_mantis and 1. rename mantis_project_category_table to mantis_category_table if needed. And 2. comment out the code with 'category' as in picture.

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 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!

15/10/2017