Non-destructive migration from Mantis to Redmine
Once in a while i have to have new software. On a recent research about using VCS on NAS devices i came across Redmine (cause they talk about GIT and Mercurial a lot). We have used Mantis for at least two years and were never really satisfied with it – don’t get me wrong, it is a great piece of software, but kind of slow to handle. However, i installed Redmine for a recent project of us and it worked out really well.
Now i had to transfer our whole mantis database of the last years into Redmine. There is an official migration guide/script, but it does work destructive (kills all your Redmine data) and has also problems with the latest Mantis version (1.2.0) – or at least i assume it’s only with the latest. Being a Perl programmer has it advantages (besides being a Perl programmer), so i wrote a migration script myself, based on the rake-file from the Redmine source.
So here is what it does in short:
- Migrate existing Mantis database non-destructive (keeps your Redmine data).
- Able to map Mantis data to coresponding Redmine data (eg users, projects and so on).
- Fully user interactive (suggest what to map to what, but gives you the capability to change.. assume you have a highly configured Mantis installation).
Things you should keep in mind before migration:
- Custom fields of the type multi list are not supported in Redmine.
- Custom fields of the type checkbox with multiple values will be translated to simple lists.
- Migrates only attachment files which are stored in the database (default).
- Tested only with Mantis 1.2.0 (current) and Redmine 0.9.3 (debian current).
- Make a backup of your Redmine database BEFORE you run the script (eg mysqldump..)!
And another thing: this is a “work in progress”, no warranties, guaranties, whats-o-ever are given.
Download (below) the script, put it in some directory (it will create multiple small YAML files and save all attachment files from the Mantis database to disk – size depends on your data).
Make it executable:
chmod +x mantis2redmine.pl
apt-get install libyaml-perl libdbix-simple-perl
Maybe create a configuration file. All command line parameters could be written in the file. Example:
mantis_db_host = localhost mantis_db_name = mantis mantis_db_login = mantis_user mantis_db_pass = mantis_password redmine_db_host = localhost redmine_db_name = redmine redmine_db_login = redmine_user redmine_db_pass = redmine_password
You can run the script with ‘–help’ to see all possible parameters.
I suggest you run the script in dry-run-mode and setup the Mantis->Redmine mappings as you like (script will guide you through):
./mantis2redmine.pl -c config.file --dry_run
Even in dry-run-mode all your mappings will be stored in files in the current folder (store-<name>.map). If you want re-configure any mapping, simply remove the store-file and run the script again. Now make a backup of your Redmine database and run the script again:
./mantis2redmine.pl -c config.file --load_maps
This could take some time, depending on the size of your original Mantis database.
After the script finishes successfully check your Redmine installation. Probably you have to assign the imported (or existing) users to the projects (because Redmine supports groups the script doesn’t do that).
The last step is to copy all exported attachment files (default in ‘./attachments/’ folder) in your Redmine file directory (in a “normal” Redmine installation this would be ‘/files’ in your Redmine base dir; if you installed via debian apt-get it is in ‘/var/lib/redmine/default/files’).
Here it is: latest (0.3.1)