Defect #19174
opendb migrate error from old version to 2.6
Added by Jasen Burkett almost 10 years ago. Updated almost 10 years ago.
0%
Description
I did the typical mysqldump to get all the data from an existing (VERY OLD) redmine install that is being used.
I sucessfully imported the old data into a new redmine (newest version) clean install on a different server.
However now when I go to the page redmine.ardemgaz.com it no longer works (redmine is broke).
In the production.log file I am getting this error everytime I go to the page.
Started GET "/" for 10.2.2.67 at 2015-02-24 21:55:23 +0000
Processing by WelcomeController#index as HTML
Current user: anonymous
Completed 500 Internal Server Error in 2.7ms
NoMethodError (undefined method `passwd_changed_on' for #<AnonymousUser:0x00000005ed6520>):
app/controllers/application_controller.rb:150:in `force_logout_if_password_changed'
When I imported the new data, I have not been able to do the following:
rake db:migrate RAILS_ENV=production
because I get an error... here is the first part of that error....
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
undefined method `inherit_members_changed?' for #<Project:0x000000032977c0>/var/lib/gems/1.9.1/gems/activemodel-3.2.21/lib/active_model/attribute_methods.rb:407:in `method_missing'
/var/lib/gems/1.9.1/gems/activerecord-3.2.21/lib/active_record/attribute_methods.rb:149:in `method_missing'
I seriously need some help here.
Thank you in advance
Related issues
Updated by Toshi MARUYAMA almost 10 years ago
- Status changed from New to Needs feedback
Jasen Burkett wrote:
I sucessfully imported the old data into a new redmine (newest version) clean install on a different server.
What versions are old and new?
Updated by Go MAEDA almost 10 years ago
Please try updating to Redmine 2.3 at first, then update to Redmine 3.0. Maybe you can finish bundle exec rake db:migrate
without the error.
The column "inherit_members" on "projects" table were added at Redmine 2.3.
Updated by Go MAEDA almost 10 years ago
Go MAEDA wrote:
Please try updating to Redmine 2.3 at first, then update to Redmine 3.0. Maybe you can finish
bundle exec rake db:migrate
without the error.The column "inherit_members" on "projects" table were added at Redmine 2.3.
Sorry, I could not avoid the error with the above steps.
Please try patching app/model/project.rb like the following while upgrading procedure. (AT YOUR OWN RISK)
I could upgrade to 2.6 from 0.8.x with the patch.
Index: app/models/project.rb
===================================================================
--- app/models/project.rb (revision 14043)
+++ app/models/project.rb (working copy)
@@ -82,7 +82,7 @@
validates_exclusion_of :identifier, :in => %w( new )
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
- after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
+ after_save :update_inherited_members, :if => Proc.new {|project| begin project.inherit_members_changed? rescue false end}
before_destroy :delete_all_members
scope :has_module, lambda {|mod|
Updated by Toshi MARUYAMA almost 10 years ago
Jasen Burkett wrote:
undefined method `inherit_members_changed?' for #<Project:0x000000032977c0>/var/lib/gems/1.9.1/gems/activemodel-3.2.21/lib/active_model/attribute_methods.rb:407:in `method_missing'
I think you run rake on Redmine 4.0 without "bundle update", because log says using Rails 3.2.21.
Updated by Jasen Burkett almost 10 years ago
The initial redmine install that is being used ( until I can get this new one working ) is like version 1.4 or earlier.
The new install is version 2.6.2? I believe.
So is all I need to do is simply create a row in the projects table called inherit_members?
Please advise..
Also, after adding that if that is what I need to do, I should then be able to do the rake command, and then my redmine install should start working again right?
Updated by Jasen Burkett almost 10 years ago
Toshi MARUYAMA wrote:
Jasen Burkett wrote:
I sucessfully imported the old data into a new redmine (newest version) clean install on a different server.
What versions are old and new?
The initial redmine install that is being used ( until I can get this new one working ) is like version 1.4 or earlier.
The new install is version 2.6.2? I believe.
So is all I need to do is simply create a row in the projects table called inherit_members?
Please advise..
Also, after adding that if that is what I need to do, I should then be able to do the rake command, and then my redmine install should start working again right?
Updated by Go MAEDA almost 10 years ago
Jasen Burkett, please try the following steps.
1. Go to the directory of Redmine 2.6.2.
2. Open app/models/project.rb with any editor.
3. Find a like like the following (maybe line 83) :
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
4. Modify the line to:
after_save :update_inherited_members, :if => Proc.new {|project| begin project.inherit_members_changed? rescue false end}
5. Execute "bundle exec rake db:migrate".
6. Revert the modifications on app/models/project.rb
Updated by Jasen Burkett almost 10 years ago
I wish I would have seen this sooner.
I already fixed that issue I was having. I actually went into the db and edited it so that it would have the rows it needed, then when I went to do the migrate, I then deleted the rows I added, this worked for me.
AS I figured this would happen. i now can not send / recieve emails into the new redmine install, before I updated or changed the database, I was able to do both. Im very frustrated at this because like I said I had it working.
Any ideas on why this would have changed?
Thank you in advance
Updated by Jean-Philippe Lang almost 10 years ago
- Assignee set to Jean-Philippe Lang
- Priority changed from High to Normal
- Target version changed from 2.6.3 to Candidate for next minor release
That would be nice to know which migration raised this error, maybe 20090312194159_add_projects_trackers_unique_index.rb
? I'd would rather fix the migration rather than cluttering models to handle migrations from very old versions.
Updated by Jasen Burkett almost 10 years ago
I understand where you are coming from on that, in order for you to best help the community I need to give more info... Is there a way to go back and see what the issue was? The production log has been cleared so I wont be able to go that route.
I fixed the issue with the email, and the fina issue I am having is for some odd reason, I can run the rake command to pull in emails to create tickets (issues) but when I run the same command via cronjob it gives me an error (rake : not found) Which is really odd because I am using the same directory that I cd into to run it outside of or directly in terminal.. confused... I am sure I'll figure it out.
thank you for all who have helped.
Updated by Go MAEDA almost 10 years ago
Jean-Philippe Lang wrote:
That would be nice to know which migration raised this error, maybe
20090312194159_add_projects_trackers_unique_index.rb
? I'd would rather fix the migration rather than cluttering models to handle migrations from very old versions.
I had same trouble when migrate Redmine 0.8.7 to 2.6.
The migration that raises the error is 105_build_projects_tree.rb
and the log of rake db:migrate
is following.
$ RAILS_ENV=production bundle exec rake db:migrate == AddCustomFieldsEditable: migrating ======================================== -- add_column(:custom_fields, :editable, :boolean, {:default=>true}) -> 0.0869s == AddCustomFieldsEditable: migrated (0.0876s) =============================== == SetCustomFieldsEditable: migrating ======================================== == SetCustomFieldsEditable: migrated (0.0222s) =============================== == AddProjectsLftAndRgt: migrating =========================================== -- add_column(:projects, :lft, :integer) -> 0.0657s -- add_column(:projects, :rgt, :integer) -> 0.0654s == AddProjectsLftAndRgt: migrated (0.1323s) ================================== == BuildProjectsTree: migrating ============================================== rake aborted! StandardError: An error has occurred, all later migrations canceled: undefined method `inherit_members_changed?' for #<Project:0x00000003425268>/var/lib/redmine/vendor/bundle/ruby/2.0/gems/activemodel-3.2.21/lib/active_model/attribute_methods.rb:407:in `method_missing' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/attribute_methods.rb:149:in `method_missing' /var/lib/redmine/app/models/project.rb:83:in `block in <class:Project>' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:464:in `_run__224995548318289063__save__241802982594570997__callbacks' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:405:in `__run_callback' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:385:in `_run_save_callbacks' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activesupport-3.2.21/lib/active_support/callbacks.rb:81:in `run_callbacks' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/callbacks.rb:264:in `create_or_update' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/persistence.rb:104:in `save!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/validations.rb:56:in `save!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/attribute_methods/dirty.rb:33:in `save!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:264:in `block in save!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:311:in `with_transaction_returning_status' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:264:in `save!' /var/lib/redmine/lib/plugins/awesome_nested_set/lib/awesome_nested_set/tree.rb:41:in `set_left_and_rights' /var/lib/redmine/lib/plugins/awesome_nested_set/lib/awesome_nested_set/tree.rb:25:in `block in rebuild!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/relation/delegation.rb:6:in `each' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/relation/delegation.rb:6:in `each' /var/lib/redmine/lib/plugins/awesome_nested_set/lib/awesome_nested_set/tree.rb:22:in `rebuild!' /var/lib/redmine/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb:15:in `block in rebuild!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/scoping/default.rb:41:in `block in unscoped' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/relation.rb:241:in `block in scoping' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/scoping.rb:98:in `with_scope' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/relation.rb:241:in `scoping' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/scoping/default.rb:41:in `unscoped' /var/lib/redmine/lib/plugins/awesome_nested_set/lib/awesome_nested_set/model/rebuildable.rb:14:in `rebuild!' /var/lib/redmine/app/models/project.rb:428:in `block in rebuild_tree!' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction' /var/lib/redmine/app/models/project.rb:426:in `rebuild_tree!' /var/lib/redmine/db/migrate/105_build_projects_tree.rb:3:in `up' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:370:in `up' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block (2 levels) in migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block in migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in `call' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:777:in `ddl_transaction' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate' /var/lib/redmine/vendor/bundle/ruby/2.0/gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
The workaround is described in #19174#note-3.
Updated by Toshi MARUYAMA almost 10 years ago
- Related to Defect #19173: Trac Migrate Script with Redmine 3.0 added
Updated by Toshi MARUYAMA almost 10 years ago
- Related to deleted (Defect #19173: Trac Migrate Script with Redmine 3.0)
Updated by Toshi MARUYAMA almost 10 years ago
- Subject changed from 500 Internal error: NoMethodError to db migrate error from old version to 2.6
Updated by Go MAEDA almost 3 years ago
- Related to Defect #36766: Database migration from Redmine 0.8.7 or earlier fails added