Project

General

Profile

Actions

Defect #20943

open

migrate_from_trac.rake dont work

Added by Karel Blumentrit about 9 years ago. Updated over 7 years ago.

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

0%

Estimated time:
Resolution:
Affected version:

Description

Hello,

I have encountered several issues with the migrate_from_trac.rake script, trying to import a Trac(V 1.0.2) Project with SQLite (V. 3.8.7.1) Database.

My Enviroment:

cat /etc/debian_version 
8.2
Environment:
  Redmine version                3.1.1.stable
  Ruby version                   2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
  Rails version                  4.2.4
  Environment                    production
  Database adapter               Mysql2
SCM:
  Git                            2.1.4
  Filesystem                     
Redmine plugins:
  no plugin installed

After applying the Patches from #19173-6 and overcomming that issue, I also applied the patch from #14567 to overcome the timestamp conversion issue.

However I now encountered a new Issue:

rake redmine:migrate_from_trac RAILS_ENV="production" --trace
(in /opt/redmine/redmine-3.1.1)
** 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 []: /tmp/project
Trac database adapter (sqlite3, mysql2, postgresql) [sqlite3]: 
Trac database encoding [UTF-8]: 
Target project identifier []: project

Trac database version is: 29
Migrating components......................
Migrating milestones................
Migrating custom fields
Migrating tickets.rake aborted!
ArgumentError: wrong number of arguments (1 for 0)
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/scoping/named.rb:24:in `all'
/opt/redmine/redmine-3.1.1/lib/tasks/migrate_from_trac.rake:180:in `attachments'
/opt/redmine/redmine-3.1.1/lib/tasks/migrate_from_trac.rake:539:in `block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:51:in `block (2 levels) in find_each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:51:in `each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:51:in `block in find_each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:124:in `find_in_batches'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/relation/batches.rb:50:in `find_each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/querying.rb:9:in `find_each'
/opt/redmine/redmine-3.1.1/lib/tasks/migrate_from_trac.rake:486:in `migrate'
/opt/redmine/redmine-3.1.1/lib/tasks/migrate_from_trac.rake:797:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/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'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.1.0/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

Please correct me if I am wrong, as I have absolutely no idea about ruby on rails programming, but (after reading throught this issue, which really ha nothing to do with the migration script: https://github.com/arkhitech/redmine_timesheet_plugin/issues/49) I assume that the Problem are those two lines:

180           TracMigrate::TracAttachment.all(:conditions => ["type = 'ticket' AND id = ?", self.id.to_s])
235           TracMigrate::TracAttachment.all(:conditions => ["type = 'wiki' AND id = ?", self.id.to_s])

which passes arguments to the all() function, which doesnt accept any arguments anymore. This seems to have changed in some Ruby on Rails Version. Maybe someone knows how to fix this and could provide a patch I could test? I tried myself, but with litteraly no knowledge about Ruby on Rails programming I failed =P

I attached the migrate_from_trac.rake with all the patches included.


Files

migrate_from_trac.rake (30 KB) migrate_from_trac.rake WIth Patches from #19173 and #14567 Karel Blumentrit, 2015-10-08 15:19
migrate_from_trac.rake (31 KB) migrate_from_trac.rake With Patches from #19173 and #14567 & correctly computed Attachment Paths for TRAC 1.0.x Karel Blumentrit, 2015-12-16 12:31

Related issues

Related to Redmine - Patch #14567: migrate_from_trac.rake does not convert timestamps in Trac database version 23New

Actions
Related to Redmine - Defect #19173: Trac Migrate Script with Redmine 3.0New

Actions
Related to Redmine - Defect #23268: migrate_from_trac.rake - NOT WORKING WITH trac 1.0.1New

Actions
Actions

Also available in: Atom PDF