Defect #19174

db migrate error from old version to 2.6

Added by Jasen Burkett over 2 years ago. Updated about 2 years ago.

Status:Needs feedbackStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:-
Target version:Candidate for next minor release
Resolution: Affected version:

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

History

#1 Updated by Toshi MARUYAMA over 2 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?

#2 Updated by Go MAEDA over 2 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.

#3 Updated by Go MAEDA over 2 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|

#4 Updated by Toshi MARUYAMA over 2 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.

#5 Updated by Jasen Burkett over 2 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?

#6 Updated by Jasen Burkett over 2 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?

#7 Updated by Go MAEDA over 2 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

#8 Updated by Jasen Burkett over 2 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

#9 Updated by Toshi MARUYAMA over 2 years ago

  • Target version set to 2.6.3

#10 Updated by Jean-Philippe Lang over 2 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.

#11 Updated by Jasen Burkett over 2 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.

#12 Updated by Go MAEDA over 2 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.

The workaround is described in #19174#note-3.

#13 Updated by Toshi MARUYAMA about 2 years ago

  • Related to Defect #19173: Trac Migrate Script with Redmine 3.0 added

#14 Updated by Toshi MARUYAMA about 2 years ago

  • Related to deleted (Defect #19173: Trac Migrate Script with Redmine 3.0)

#15 Updated by Toshi MARUYAMA about 2 years ago

  • Subject changed from 500 Internal error: NoMethodError to db migrate error from old version to 2.6

Also available in: Atom PDF