Validation failed: Role is invalid on upgrade from 0.7.3
Added by David Lyons almost 14 years ago
I am looking for a bit of direction/and/or help. I am trying to upgrade our .7.3 version of Redmine, and I can't get past the db migration. Here is what I have done:
I took an ubuntu 10.10 VM, followed the install instructions at http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_Ubuntu. At this point, I went to the site and it was working. I backed up the database, loaded a copy of our current .7.3 install, then followed the upgrade instructions at http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade. The problem is when I try to update the Database, and I get:
root@ubuntu:/usr/share/redmine# 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 == PopulateMemberRoles: migrating ============================================ rake aborted! An error has occurred, all later migrations canceled: Validation failed: Role is invalid /usr/lib/ruby/1.8/active_record/validations.rb:1090:in `save_without_dirty!' /usr/lib/ruby/1.8/active_record/dirty.rb:87:in `save_without_transactions!' /usr/lib/ruby/1.8/active_record/transactions.rb:200:in `save!' /usr/lib/ruby/1.8/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction' /usr/lib/ruby/1.8/active_record/transactions.rb:182:in `transaction' /usr/lib/ruby/1.8/active_record/transactions.rb:200:in `save!' /usr/lib/ruby/1.8/active_record/transactions.rb:208:in `rollback_active_record_state!' /usr/lib/ruby/1.8/active_record/transactions.rb:200:in `save!' /usr/lib/ruby/1.8/active_record/validations.rb:1059:in `create!' ./db/migrate//20090503121505_populate_member_roles.rb:5:in `up_without_benchmarks' ./db/migrate//20090503121505_populate_member_roles.rb:4:in `each' ./db/migrate//20090503121505_populate_member_roles.rb:4:in `up_without_benchmarks' /usr/lib/ruby/1.8/active_record/migration.rb:282:in `send' /usr/lib/ruby/1.8/active_record/migration.rb:282:in `migrate' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/lib/ruby/1.8/active_record/migration.rb:282:in `migrate' /usr/lib/ruby/1.8/active_record/migration.rb:365:in `__send__' /usr/lib/ruby/1.8/active_record/migration.rb:365:in `migrate' /usr/lib/ruby/1.8/active_record/migration.rb:486:in `migrate' /usr/lib/ruby/1.8/active_record/migration.rb:562:in `call' /usr/lib/ruby/1.8/active_record/migration.rb:562:in `ddl_transaction' /usr/lib/ruby/1.8/active_record/migration.rb:485:in `migrate' /usr/lib/ruby/1.8/active_record/migration.rb:472:in `each' /usr/lib/ruby/1.8/active_record/migration.rb:472:in `migrate' /usr/lib/ruby/1.8/active_record/migration.rb:400:in `up' /usr/lib/ruby/1.8/active_record/migration.rb:383:in `migrate' /usr/share/redmine/vendor/rails/railties/lib/tasks/databases.rake:116 /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
I am at a loss, and google isn't much help. The info page from our install:
Information Redmine 0.7.3.31518 (MySQL) Default administrator account changed File repository writable RMagick available (optional) Plugins Timesheet Plugin This is a Timesheet plugin for Redmine to show timelogs for all projects Eric Davis of Little Stream Software 0.0.1
Replies (2)
RE: Validation failed: Role is invalid on upgrade from 0.7.3 - Added by Felix Schäfer almost 14 years ago
I have a guess what the problem might be, I don't have enough to walk you through though. If "there probably is a clash between a validation introduced in a later version and that migration" is enough of a hint for you, you should be able to tackle it on your own. If not, you could contact the guys from PlanIO (see CommercialOfferings), they should be able to get you through the upgrade.
RE: Validation failed: Role is invalid on upgrade from 0.7.3 - Added by David Lyons almost 14 years ago
I was able to make the upgrade work with the following change, removing the validate on MemberRole just so the migration could occur, then putting it back:
Index: app/models/member_role.rb =================================================================== --- app/models/member_role.rb (revision 4879) +++ app/models/member_role.rb (working copy) @@ -26,9 +26,9 @@ validates_presence_of :role - def validate - errors.add :role_id, :invalid if role && !role.member? - end +# def validate +# errors.add :role_id, :invalid if role && !role.member? +# end def inherited? !inherited_from.nil?
I am a bit worried about the implications though, does anyone know what might I might have borked in the data doing this?