Project

General

Profile

Actions

Defect #19173

open

Trac Migrate Script with Redmine 3.0

Added by Robert V over 9 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Importers
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

I have a basic Redmine 3.0 installation, using the redmine migrate_from_trac script

mysql  Ver 15.1 Distrib 5.5.41-MariaDB, for Linux (x86_64) using readline 5.1
ruby 2.0.0p353 (2013-11-22) [x86_64-linux]
Rails 4.2.0

CentOS 7 install, using EPEL's ruby version.
[root@ticket redmine]# ./bin/about 

sh: svn: command not found
sh: darcs: command not found
sh: hg: command not found
sh: cvs: command not found
sh: bzr: command not found
Environment:
  Redmine version                3.0.0.stable
  Ruby version                   2.0.0-p353 (2013-11-22) [x86_64-linux]
  Rails version                  4.2.0
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  redmine_agile                  1.3.7

[root@ticket redmine]# rake redmine:migrate_from_trac RAILS_ENV="production" 
rake aborted!
NoMethodError: undefined method `set_inheritance_column' for TracMigrate::TracAttachment(Table doesn't exist):Class
/usr/local/share/gems/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:121:in `<class:TracAttachment>'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:119:in `<module:TracMigrate>'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:25:in `block (2 levels) in <top (required)>'
Tasks: TOP => redmine:migrate_from_trac
(See full trace by running task with --trace)
[root@ticket redmine]# 

And again with --trace:

[root@ticket redmine]# rake redmine:migrate_from_trac RAILS_ENV="production" --trace
** Invoke redmine:migrate_from_trac (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:migrate_from_trac
rake aborted!
NoMethodError: undefined method `set_inheritance_column' for TracMigrate::TracAttachment(Table doesn't exist):Class
/usr/local/share/gems/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:121:in `<class:TracAttachment>'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:119:in `<module:TracMigrate>'
/var/www/redmine/lib/tasks/migrate_from_trac.rake:25:in `block (2 levels) in <top (required)>'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/usr/local/share/gems/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => redmine:migrate_from_trac


Related issues

Related to Redmine - Defect #20943: migrate_from_trac.rake dont workResolved

Actions
Actions #1

Updated by Senthil Kalimuthu over 9 years ago

I'm newbie to ruby..

I had the same issue and able to pass few more errors from here... I'm on Ubuntu 14.04.2 and the ./bin/about is

Environment:
  Redmine version                3.0.0.stable
  Ruby version                   1.9.3-p484 (2013-11-22) [x86_64-linux]
  Rails version                  4.2.0
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.8.8
  Darcs                          2.8.4
  Mercurial                      2.8.2
  Cvs                            1.12.13
  Bazaar                         2.7.0
  Git                            1.9.1
  Filesystem
Redmine plugins:
  redmine_agile                  1.3.8
  redmine_checklists             3.0.4

I'm able to pass this error by changing the the "set_inheritance_column :none" to "self.inheritance_column = nil" on line numbers 121 and 166.

I got this clue from stakeoverflow that set_inheritance_column is deprecated from rails 3.1.

I was able to pass the next error which is again deprecated like set_inheritance_column . Replaced "set_primary_key :name" to "self.primary_key = :name"

The error was

 NoMethodError: undefined method `set_primary_key' for TracMigrate::TracWikiPage(Table doesn't exist):Class

Now I'm having another error which I dont have a clue..

root@orion:/u01/data/www/redmine# rake redmine:migrate_from_trac RAILS_ENV="test" --trace
** Invoke redmine:migrate_from_trac (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:migrate_from_trac

WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y

Trac directory []: /data/www/trac/orion
Trac database adapter (sqlite3, mysql2, postgresql) [sqlite3]:
Trac database encoding [UTF-8]:
Target project identifier []: migratedorion

Migrating components.......
Migrating milestones.rake aborted!
TypeError: no implicit conversion from nil to integer
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:420:in `[]'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:420:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb:46:in `each'
/var/lib/gems/1.9.1/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb:46:in `each'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:408:in `migrate'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:768:in `block (2 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => redmine:migrate_from_trac
Actions #2

Updated by Marc Rijken over 9 years ago

After the proposed changes of Senthil I get:

rake aborted!
ActiveRecord::AssociationTypeMismatch: Tracker(#35966420) expected, got NilClass(#8943420)
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.0/lib/active_record/associations/association.rb:216:in `raise_on_type_mismatch!'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.0/lib/active_record/associations/has_many_through_association.rb:34:in `block in concat'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.0/lib/active_record/associations/has_many_through_association.rb:33:in `each'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.0/lib/active_record/associations/has_many_through_association.rb:33:in `concat'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/activerecord-4.2.0/lib/active_record/associations/collection_proxy.rb:964:in `<<'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:687:in `target_project_identifier'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:760:in `block (3 levels) in <top (required)>'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:743:in `prompt'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:760:in `block (2 levels) in <top (required)>'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/home/redmine/redmine/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => redmine:migrate_from_trac

Actions #3

Updated by Toshi MARUYAMA over 9 years ago

  • Category changed from Ruby support to Importers
Actions #4

Updated by Toshi MARUYAMA over 9 years ago

  • Related to Defect #19174: db migrate error from old version to 2.6 added
Actions #5

Updated by Toshi MARUYAMA over 9 years ago

  • Related to deleted (Defect #19174: db migrate error from old version to 2.6)
Actions #6

Updated by Mathieu BODIN over 9 years ago

I was able to get rid of those errors by updating migrate_from_trac.rake (for the record I'm running rails 4.2.0)

All I had to do was using :
  • self.inheritance_column = :none instead of set_inheritance_column :none
  • self.primary_key = 'name' instead of #set_primary_key :name
Actions #7

Updated by Toshi MARUYAMA about 9 years ago

  • Related to Defect #20943: migrate_from_trac.rake dont work added
Actions #8

Updated by Michael Pfeiffer over 8 years ago

Any solutions for this issue from Senthil?

root@orion:/u01/data/www/redmine# rake redmine:migrate_from_trac RAILS_ENV="test" --trace
** Invoke redmine:migrate_from_trac (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:migrate_from_trac

WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y

Trac directory []: /data/www/trac/orion
Trac database adapter (sqlite3, mysql2, postgresql) [sqlite3]:
Trac database encoding [UTF-8]:
Target project identifier []: migratedorion

Migrating components.......
Migrating milestones.rake aborted!
TypeError: no implicit conversion from nil to integer
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:420:in `[]'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:420:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb:46:in `each'
/var/lib/gems/1.9.1/gems/activerecord-4.2.0/lib/active_record/relation/delegation.rb:46:in `each'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:408:in `migrate'
/u01/data/www/redmine-3.0.0/lib/tasks/migrate_from_trac.rake:768:in `block (2 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => redmine:migrate_from_trac

I have the same issue

** Invoke redmine:migrate_from_trac (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:migrate_from_trac

WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y

Trac directory []: /opt/trac/sowiki
Trac database adapter (sqlite3, mysql2, postgresql) [sqlite3]: postgresql
Trac database name []: tracdb
Trac database schema [public]: public
Trac database encoding [UTF-8]: 
Target project identifier []: sowiki

This project already exists in your Redmine database.
Are you sure you want to append data to this project ? [Y/n] Y

Migrating components........................
Migrating milestones.rake aborted!
TypeError: no implicit conversion from nil to integer
/opt/redmine/lib/tasks/migrate_from_trac.rake:423:in `[]'
/opt/redmine/lib/tasks/migrate_from_trac.rake:423:in `block in migrate'
/var/lib/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/var/lib/gems/2.2.0/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/opt/redmine/lib/tasks/migrate_from_trac.rake:411:in `migrate'
/opt/redmine/lib/tasks/migrate_from_trac.rake:776:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `call'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:248:in `block in execute'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `each'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:243:in `execute'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:180:in `invoke_with_call_chain'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/task.rb:173:in `invoke'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.2.0/gems/rake-11.1.1/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.2.0/gems/rake-11.1.1/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'
Tasks: TOP => redmine:migrate_from_trac

And I really don't have a clue what's the solution for that :(

Thx

Actions #9

Updated by J Wong over 8 years ago

My workaround for Senthil's issue is to either ignore the text size limit of the custom field, or manually set a constant.

To do this, open the migration script (/path/to/redmine/lib/tasks/migrate_from_trac.rake), search the following:

field.name[0, limit_for(IssueCustomField, 'name')]

then replace with one of the following:

field.name            # Ignore the limit
field.name[0, 100]    # Set a limit
Actions

Also available in: Atom PDF