Defect #10504

migrate_from_mantis script fails on first project when trying to update version dates

Added by Alan Chandler over 4 years ago. Updated over 2 years ago.

Status:ResolvedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:-
Resolution: Affected version:

Description

The script fails with the following trace (NOTE: This is based on applying the patch I just posted against #15501

Migrating users......
rake aborted!
undefined method `to_date' for 1312467840:Fixnum
/home/alan/dev/redmine/lib/tasks/migrate_from_mantis.rake:289:in `migrate'
/home/alan/dev/redmine/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing'
/home/alan/dev/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `each'
/home/alan/dev/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/home/alan/dev/redmine/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/home/alan/dev/redmine/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:392:in `method_missing'
/home/alan/dev/redmine/lib/tasks/migrate_from_mantis.rake:286:in `migrate'
/home/alan/dev/redmine/lib/tasks/migrate_from_mantis.rake:267:in `each'
/home/alan/dev/redmine/lib/tasks/migrate_from_mantis.rake:267:in `migrate'
/home/alan/dev/redmine/lib/tasks/migrate_from_mantis.rake:509
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

This time my environment is different from that reported in #15501, I am on a debian Unstable machine with the following environment

About your application's environment
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.8.15
Rack version 1.1.3
Rails version 2.3.14
Active Record version 2.3.14
Active Resource version 2.3.14
Action Mailer version 2.3.14
Active Support version 2.3.14
Edge Rails revision 84b6b8bfd869a4fc91d434adca74adfb661537b2
Application root /home/alan/dev/redmine
Environment production
Database adapter sqlite3
Database schema version 20110902000000

migrate2.patch Magnifier (1.04 KB) Alan Chandler, 2012-03-23 16:05

migrate2.patch Magnifier (2.09 KB) Alan Chandler, 2012-03-23 16:19


Related issues

Related to Redmine - Defect #10532: migrate_from_mantis script fails with missing table name Resolved
Related to Redmine - Defect #18984: migrate_from_mantis with NoMethodError: strftime Resolved

History

#1 Updated by Alan Chandler over 4 years ago

references to #15501 should be #10501

#2 Updated by Alan Chandler over 4 years ago

I am still trying to understand this issue, but as I am completely new to Ruby, let alone all the other lays of framework, I am struggling a bit.

As far as I can make out, the problem is with the "date_order" column in the version table in mantis. This is declared (in my mysql version) as INT, but seems to be the number if seconds since 1970. In my redmine (sqlite3) database that is the target, we are looking at the effective_date field. This is declared as type DATE, although in SQLite it is stored as a field of type Numeric.

In order to handle that change the script does effective_date => (version.date_order ? version.date_order.to_date : nil) but fails on the .to_date function.

#3 Updated by Alan Chandler over 4 years ago

I think the attached patch fixes this issue

#4 Updated by Alan Chandler over 4 years ago

Apologies, but the attached patch in the above update has Time.At as opposed to Time.at in it, and then fails. Revised patch attached

#5 Updated by Alan Chandler over 4 years ago

  • Status changed from New to Resolved

The fix for this issue is contained within #10532

#6 Updated by meta tech over 2 years ago

With version 2.5.0 I have the same problem, migrating from Mantis mysql DB.

Migrating users............
rake aborted!
undefined method `to_date' for 1242123547:Bignum
/home/user/redmine-2.5.0/lib/tasks/migrate_from_mantis.rake:289:in `migrate'
/var/lib/gems/1.8/gems/activerecord-3.2.17/lib/active_record/associations/collection_proxy.rb:91:in `each'
/var/lib/gems/1.8/gems/activerecord-3.2.17/lib/active_record/associations/collection_proxy.rb:91:in `send'
/var/lib/gems/1.8/gems/activerecord-3.2.17/lib/active_record/associations/collection_proxy.rb:91:in `method_missing'
/home/user/redmine-2.5.0/lib/tasks/migrate_from_mantis.rake:286:in `migrate'
/home/user/redmine-2.5.0/lib/tasks/migrate_from_mantis.rake:266:in `each'
/home/user/redmine-2.5.0/lib/tasks/migrate_from_mantis.rake:266:in `migrate'
/home/user/redmine-2.5.0/lib/tasks/migrate_from_mantis.rake:514
Tasks: TOP => redmine:migrate_from_mantis
(See full trace by running task with --trace)

Was the fix ever included ?
Thanks.

#7 Updated by Toshi MARUYAMA over 2 years ago

  • Related to Defect #10532: migrate_from_mantis script fails with missing table name added

#8 Updated by Toshi MARUYAMA over 2 years ago

  • Category set to Importers

#9 Updated by Toshi MARUYAMA over 1 year ago

  • Related to Defect #18984: migrate_from_mantis with NoMethodError: strftime added

Also available in: Atom PDF