Error while migrating from 0.7.3 -> 0.9.3
Added by Cedric Jeanneret over 14 years ago
Hello,
I have a problem while migrating my redmine instance from an old 0.7.3 to the latest present in debian backports (0.9.3): I'm unable to migrate the database.
I have this error :
rake --trace db:migrate RAILS_ENV=production (in /usr/share/redmine) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:migrate == BuildProjectsTree: migrating ============================================== rake aborted! An error has occurred, this and all later migrations canceled: Validation failed: Homepage is too long (maximum is 255 characters) /usr/share/redmine/vendor/rails/activerecord/lib/active_record/validations.rb:1021:in `save_without_dirty!' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:129:in `transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:158:in `rollback_active_record_state!' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:186:in `rebuild!' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `call' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `rebuild!' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `each' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `rebuild!' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `call' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `rebuild!' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `each' /usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `rebuild!' ./db/migrate//105_build_projects_tree.rb:3:in `up_without_benchmarks' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `send' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `migrate' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `migrate' (__DELEGATION__):2:in `__send__' (__DELEGATION__):2:in `migrate' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:480:in `migrate' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `call' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `ddl_transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:129:in `transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `ddl_transaction' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:479:in `migrate' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:466:in `each' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:466:in `migrate' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:394:in `up' /usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:377:in `migrate' /usr/share/redmine/vendor/rails/railties/lib/tasks/databases.rake:111 /usr/lib/ruby/1.8/rake.rb:636:in `call' /usr/lib/ruby/1.8/rake.rb:636:in `execute' /usr/lib/ruby/1.8/rake.rb:631:in `each' /usr/lib/ruby/1.8/rake.rb:631:in `execute' /usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize' /usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:583:in `invoke' /usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2029:in `each' /usr/lib/ruby/1.8/rake.rb:2029:in `top_level' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:2023:in `top_level' /usr/lib/ruby/1.8/rake.rb:2001:in `run' /usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1998:in `run' /usr/bin/rake:28
But if I check the projects.homepage field :
select id, homepage, char_length(homepage) from projects where homepage <> '' and char_length(homepage) > 255; id | homepage | char_length ----+----------+------------- (0 rows)
More over, I checked projects table, and it seems that in 0.9.3 "homepage" fields has only 60 chars.
So I checked :
select id, homepage, char_length(homepage) from projects where homepage <> '' and char_length(homepage) > 60; id | homepage | char_length ----+----------+------------- (0 rows)
... any idea ? Maybe there's another "homepage" field in another table, but as it's in "BuildProjectsTree" I guess it's in projects table.
Thank you in advance.
C.
Replies (10)
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
Any hint for this ? We really need to upgrade, and for now, we just cannot because of this problem...
Thank you.
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Felix Schäfer over 14 years ago
The error occurs while the migration tries to rebuild the project tree.
I don't really understand what's happening here, especially as it appears to be some postgres thing happening, but try to remove all homepages and upgrade. You will then need to put them back manually, but at least you should be able to upgrade.
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
Thank you. I was affraid to have to do this... but anyway, I'm working in kvms, with copies. So I cannot break anything.
I'll try it as soon as possible.
I'll keep this thread up to date.
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Michael Mezger over 14 years ago
we have running 2 installtions (0.8.x) from redmine.. and today i was updating to 0.9. The smaller instance of both ist now updated, but the larger installation makes me cry :-) i got the exactly same problem. i have analyzed the problem (statement logging, etc.) but without success.
what could i do to perform the project rebuild?
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
hmmm. Maybe the project size does matter... ?
Have you checked length for homepage field content ?
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Michael Mezger over 14 years ago
yes i did - there are only valid values.
i have 89 projects, but i assume the project count doesnt matter. but there are a few custom fields. few of them are changed to a required field after the objects had already values / no values. but i rechanged the fields to none-required fields, without success :/
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
Maybe there's something in the redmine configuration which can make trouble.. You talk about required field... ? (Have ton confess, I don't have access to the redmine interface as it's for one of our clients, they just want us to migrate the content... I'll ask if I can have an access if it can help)
I'll try tomorrow in some KVM to see the configuration table...
Keep up to date.
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Michael Mezger over 14 years ago
i workedaround the problem. i disabled line app/models/project.rb:70
#validates_length_of :homepage, :maximum => 255
without this line it works...
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
Oh.. I didn't see this.... This is cool, because in 001_setup.rb :
t.column "homepage", :string, :limit => 60, :default => ""^M
hmmmm..... maybe THAT'S the problem.
I'll try with your "patch". Thank you for digging into this.
RE: Error while migrating from 0.7.3 -> 0.9.3 - Added by Cedric Jeanneret over 14 years ago
Ok, it worked, but I had to comment out also line 71 (the check """validates_length_of :identifier, :in => 1..20""")
really strange. I'm redoing all the stuff from scratch so that I'll see if redmine itself works.