Defect #1164
closedImport Trac Data
0%
Description
When doing an import of Trac data, I get the following errors. The problem line is 95 from redmine/lib/tasks/migrate_from_trac, a subset of which I included here:
91 class TracMilestone < ActiveRecord::Base
92 set_table_name :milestone
93
94 def due
95 if read_attribute(:due) > 0
96 Time.at(read_attribute(:due)).to_date
97 else
98 nil
99 end
I think the code needs to evaluate null values as well. I don't know Ruby syntax well enough to tackle this, but the logic should be something like "IF :due is not NULL and if due > 0 THEN ... else nil." Alternatively, could it be a sqlite version mismatch, which I have seen in other forums? It seems if this were the case, I would not have even gotten as far as I did in the import.
Can anyone verify if my approach is correct, and then perhaps help me with getting the syntax correct in the import code? Trace is included as well. Thanks in advance.
rake --trace redmine:migrate_from_trac RAILS_ENV="production"(in /root/redmine)
- 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 []: /mnt/atkins/m4l
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: m4l
Migrating components...........
Migrating milestones.......rake aborted!
undefined method `>' for nil:NilClass
/root/redmine/lib/tasks/migrate_from_trac.rake:95:in `due'
/root/redmine/lib/tasks/migrate_from_trac.rake:309:in `migrate'
/root/redmine/lib/tasks/migrate_from_trac.rake:303:in `each'
/root/redmine/lib/tasks/migrate_from_trac.rake:303:in `migrate'
/root/redmine/lib/tasks/migrate_from_trac.rake:643
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19