
Mantis to Redmine migration script updates

One day I decided to upgrade my current bugtracker (Mantis 1.2.8) into higher level. I chose Redmine 2.0.3.
As Google said It was supposed to be quite easy to migrate data. You just go through this doc http://www.redmine.org/projects/redmine/wiki/RedmineMigrate. Try it first, it might just work for you.
Unfortunately official rake file gave me some errors so I upgraded it a bit.
Here is what you need to migrate data from Mantis 1.2.8 (other versions not tested by me) to Redmine 2.0.3 (other versions not tested by me):
I give no warranty so make sure you backed up your data!
1. Update Mantis database to create DATETIME columns (Mantis has TIMESTAMP columns only by default). This process is data safe. Depends on what database you use import one of this files:
- MySQL Mantis updater, use if your Mantis is based on MySQL database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
-- ALTER TABLE mantis_bug_table DROP COLUMN date_submitted_redmine; -- ALTER TABLE mantis_bug_table DROP COLUMN last_updated_redmine; -- ALTER TABLE mantis_bugnote_table DROP COLUMN date_submitted_redmine; -- ALTER TABLE mantis_bug_file_table DROP COLUMN date_added_redmine; -- ALTER TABLE mantis_news_table DROP COLUMN date_posted_redmine; -- ALTER TABLE mantis_project_version_table DROP COLUMN date_order_redmine; ALTER TABLE mantis_bug_table ADD date_submitted_redmine DATETIME; ALTER TABLE mantis_bug_table ADD last_updated_redmine DATETIME; ALTER TABLE mantis_bugnote_table ADD date_submitted_redmine DATETIME; ALTER TABLE mantis_bug_file_table ADD date_added_redmine DATETIME; ALTER TABLE mantis_news_table ADD date_posted_redmine DATETIME; ALTER TABLE mantis_project_version_table ADD date_order_redmine DATETIME; UPDATE mantis_bug_table SET date_submitted_redmine = FROM_UNIXTIME(date_submitted); UPDATE mantis_bug_table SET last_updated_redmine = FROM_UNIXTIME(last_updated); UPDATE mantis_bugnote_table SET date_submitted_redmine = FROM_UNIXTIME(date_submitted); UPDATE mantis_bug_file_table SET date_added_redmine = FROM_UNIXTIME(date_added); UPDATE mantis_news_table SET date_posted_redmine = FROM_UNIXTIME(date_posted); UPDATE mantis_project_version_table SET date_order_redmine = FROM_UNIXTIME(date_order); |
- PostgreSQL Mantis updater, use if yout Mantis is based on PostgreSQL database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
-- ALTER TABLE mantis_bug_table DROP COLUMN date_submitted_redmine; -- ALTER TABLE mantis_bug_table DROP COLUMN last_updated_redmine; -- ALTER TABLE mantis_bugnote_table DROP COLUMN date_submitted_redmine; -- ALTER TABLE mantis_bug_file_table DROP COLUMN date_added_redmine; -- ALTER TABLE mantis_news_table DROP COLUMN date_posted_redmine; -- ALTER TABLE mantis_project_version_table DROP COLUMN date_order_redmine; ALTER TABLE mantis_bug_table ADD date_submitted_redmine timestamp; ALTER TABLE mantis_bug_table ADD last_updated_redmine timestamp; ALTER TABLE mantis_bugnote_table ADD date_submitted_redmine timestamp; ALTER TABLE mantis_bug_file_table ADD date_added_redmine timestamp; ALTER TABLE mantis_news_table ADD date_posted_redmine timestamp; ALTER TABLE mantis_project_version_table ADD date_order_redmine timestamp; UPDATE mantis_bug_table SET date_submitted_redmine = to_timestamp(date_submitted); UPDATE mantis_bug_table SET last_updated_redmine = to_timestamp(last_updated); UPDATE mantis_bugnote_table SET date_submitted_redmine = to_timestamp(date_submitted); UPDATE mantis_bug_file_table SET date_added_redmine = to_timestamp(date_added); UPDATE mantis_news_table SET date_posted_redmine = to_timestamp(date_posted); UPDATE mantis_project_version_table SET date_order_redmine = to_timestamp(date_order); |
2. Go to your rails root directory and run this command to migrate data (RAILS_ENV depends on yours configuration, it might be i.e. “test”, in my case it was “production”):
1 |
rake redmine:migrate_from_mantis RAILS_ENV="production" |
More details here http://www.redmine.org/projects/redmine/wiki/RedmineMigrate. This command uses default migrate_from_mantis.rake file.
If this script fails, like mine, try one of those:
- use my rake update – backup REDMINE/lib/tasks/migrate_from_mantis.rake and replace it by migrate_from_mantis.rake updated by me.
- if it still fails – backup REDMINE/lib/tasks/migrate_from_mantis.rake and replace it by migrate_from_mantis.rake some old version.
- if it still fails – backup REDMINE/lib/tasks/migrate_from_mantis.rake and replace it by newest migrate_from_mantis.rake from GIT official repository.
That’s all.
You can also see: