migrate_from_mantis Mysql::Error
Added by Valeri Mytinski over 14 years ago
While trying to migrate from Mantis 1.0.8 to Redmine (bitnami-redmine-1.1.1-0-windows-installer.exe) I got:
Migrating users...............
Migrating projectsrake aborted!
Mysql::Error: Duplicate entry '1-1' for key 1: INSERT INTO `projects_trackers` (`project_id`, `tracker_id`) VALUES (1, 1
)
It is possible to migrate partly:
Users:           15/15
Projects:        20/50
Memberships:     43/92
Versions:        38/60
Categories:      110/230
Bugs:            571/929
Bug notes:       642/1060
Bug files:       140/240
Bug relations:   1/1
Bug monitors:    5/11
News:            0/4
Custom fields:   0/0
but only if I comment these 2 lines (near 277-280) in migrate_from_mantis.rake:
        p.trackers << TRACKER_BUG
        p.trackers << TRACKER_FEATURE
Questions: 
1) Is there requirements for Mantis version to migrate from?
2) If no, what is the problem and how it can be solved?
PS My steps are: 
- drop and create empty database
- rake db:migrate
- rake redmine:load_default_data
- rake redmine:migrate_from_mantis
Replies (8)
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by WMI Admin over 14 years ago
  
  Have same issue:
Migrating users.................................................
rake aborted!
Mysql::Error: Duplicate entry '1-1' for key 1: INSERT INTO `projects_trackers` (`project_id`, `tracker_id`) VALUES (1, 1)
Any solution ?
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by Etienne Massip over 14 years ago
  
  There are requirements, see RedmineMigrate.
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by WMI Admin over 14 years ago
  
  MantisBT 1.2.2
Redmine 1.1.2.devel
Steps:
1. Create Clean Redmine DB
2. Load Default data in Redmine DB
3. Run Migration Script
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by WMI Admin over 14 years ago
  
  Valeri Mytinski
try our solution:
1. Create Clean Redmine DB
2. Load Default data in Redmine DB
3. 
mysql -uroot -p'*********'
ALTER TABLE `redmine`.`projects_trackers` DROP INDEX `projects_trackers_unique`;
QUIT;
4. Run Migration Script
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by Enogu KUROI over 14 years ago
  
  Currently, Project.trackers seems to be initialized when created. (see app/models/project.rb rev.4460)
Try edit lib/task/migrate_from_mantis.rake like this:
p.enabled_module_names = ['issue_tracking', 'news', 'wiki']
p.trackers.clear  # insert this line !
p.trackers << TRACKER_BUG
p.trackers << TRACKER_FEATURE
here is my (very ugly lol) script to migrate Mantis 1.2.2 to Redmine trunk(rev.5856).
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by Enogu KUROI over 14 years ago
  
  the last script has a serious bug. it can not handle the date field correctly.
here is modified version. sorry for my ugly work X-(
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by Antonio  Garcia Marin over 14 years ago
  
  For me the "alter table" solution works.
Before try the migrate script i delete all rows in the projects table
Mantis 1.0.5 -> BitNami Redmine Stack 1.2.0-0
    
    RE: migrate_from_mantis Mysql::Error
    -
    Added by john lin almost 14 years ago
  
  To Enogu KUROI :
thanks for your script.
but there's a bug in it, causing flowing exception
undefined local variable or method `cname' for MantisMigrate:Module
Here's the fixed version.