https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292015-02-25T04:36:29ZRedmineRedmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=616922015-02-25T04:36:29ZToshi MARUYAMA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs feedback</i></li></ul><p>Jasen Burkett wrote:</p>
<blockquote>
<p>I sucessfully imported the old data into a new redmine (newest version) clean install on a different server.</p>
</blockquote>
<p>What versions are old and new?</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617042015-02-25T10:39:34ZGo MAEDA
<ul></ul><p>Please try updating to Redmine 2.3 at first, then update to Redmine 3.0. Maybe you can finish <code>bundle exec rake db:migrate</code> without the error.</p>
<p>The column "inherit_members" on "projects" table were added at Redmine 2.3.</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617062015-02-25T11:16:24ZGo MAEDA
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>Please try updating to Redmine 2.3 at first, then update to Redmine 3.0. Maybe you can finish <code>bundle exec rake db:migrate</code> without the error.</p>
<p>The column "inherit_members" on "projects" table were added at Redmine 2.3.</p>
</blockquote>
<p>Sorry, I could not avoid the error with the above steps.<br />Please try patching app/model/project.rb like the following while upgrading procedure. (AT YOUR OWN RISK)<br />I could upgrade to 2.6 from 0.8.x with the patch.</p>
<pre><code class="diff syntaxhl"><span class="gh">Index: app/models/project.rb
===================================================================
</span><span class="gd">--- app/models/project.rb (revision 14043)
</span><span class="gi">+++ app/models/project.rb (working copy)
</span><span class="p">@@ -82,7 +82,7 @@</span>
validates_exclusion_of :identifier, :in => %w( new )
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
<span class="gd">- after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
</span><span class="gi">+ after_save :update_inherited_members, :if => Proc.new {|project| begin project.inherit_members_changed? rescue false end}
</span> before_destroy :delete_all_members
scope :has_module, lambda {|mod|
</code></pre> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617072015-02-25T11:25:12ZToshi MARUYAMA
<ul></ul><p>Jasen Burkett wrote:</p>
<blockquote>
<p>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'</p>
</blockquote>
<p>I think you run rake on Redmine 4.0 without "bundle update", because log says using Rails 3.2.21.</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617132015-02-25T14:29:13ZJasen Burkett
<ul></ul><p>The initial redmine install that is being used ( until I can get this new one working ) is like version 1.4 or earlier.</p>
<p>The new install is version 2.6.2? I believe.</p>
<p>So is all I need to do is simply create a row in the projects table called inherit_members?</p>
<p>Please advise..</p>
<p>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?</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617142015-02-25T14:30:50ZJasen Burkett
<ul></ul><p>Toshi MARUYAMA wrote:</p>
<blockquote>
<p>Jasen Burkett wrote:</p>
<blockquote>
<p>I sucessfully imported the old data into a new redmine (newest version) clean install on a different server.</p>
</blockquote>
<p>What versions are old and new?</p>
</blockquote>
<p>The initial redmine install that is being used ( until I can get this new one working ) is like version 1.4 or earlier.</p>
<p>The new install is version 2.6.2? I believe.</p>
<p>So is all I need to do is simply create a row in the projects table called inherit_members?</p>
<p>Please advise..</p>
<p>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?</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617182015-02-25T23:28:03ZGo MAEDA
<ul></ul><p>Jasen Burkett, please try the following steps.</p>
<p>1. Go to the directory of Redmine 2.6.2.<br />2. Open app/models/project.rb with any editor.<br />3. Find a like like the following (maybe line 83) :</p>
<pre>
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
</pre>
<p>4. Modify the line to:</p>
<pre>
after_save :update_inherited_members, :if => Proc.new {|project| begin project.inherit_members_changed? rescue false end}
</pre>
<p>5. Execute "bundle exec rake db:migrate". <br />6. Revert the modifications on app/models/project.rb</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=617192015-02-26T03:13:50ZJasen Burkett
<ul></ul><p>I wish I would have seen this sooner.</p>
<p>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.</p>
<p>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.</p>
<p>Any ideas on why this would have changed?</p>
<p>Thank you in advance</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=618422015-03-04T04:14:26ZToshi MARUYAMA
<ul><li><strong>Target version</strong> set to <i>2.6.3</i></li></ul> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=620322015-03-08T09:39:07ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Priority</strong> changed from <i>High</i> to <i>Normal</i></li><li><strong>Target version</strong> changed from <i>2.6.3</i> to <i>Candidate for next minor release</i></li></ul><p>That would be nice to know which migration raised this error, maybe <code>20090312194159_add_projects_trackers_unique_index.rb</code>? I'd would rather fix the migration rather than cluttering models to handle migrations from very old versions.</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=620572015-03-08T19:41:36ZJasen Burkett
<ul></ul><p>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.</p>
<p>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.</p>
<p>thank you for all who have helped.</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=620602015-03-09T00:33:25ZGo MAEDA
<ul></ul><p>Jean-Philippe Lang wrote:</p>
<blockquote>
<p>That would be nice to know which migration raised this error, maybe <code>20090312194159_add_projects_trackers_unique_index.rb</code>? I'd would rather fix the migration rather than cluttering models to handle migrations from very old versions.</p>
</blockquote>
<p>I had same trouble when migrate Redmine 0.8.7 to 2.6.<br />The migration that raises the error is <code>105_build_projects_tree.rb</code> and the log of <code>rake db:migrate</code> is following.</p>
<p><a href="#" onclick="$('#collapse-75a4b4c8-show, #collapse-75a4b4c8-hide').toggle(); $('#collapse-75a4b4c8').fadeToggle(150);; return false;" id="collapse-75a4b4c8-show" class="icon icon-collapsed collapsible">Show</a><a href="#" onclick="$('#collapse-75a4b4c8-show, #collapse-75a4b4c8-hide').toggle(); $('#collapse-75a4b4c8').fadeToggle(150);; return false;" id="collapse-75a4b4c8-hide" class="icon icon-expended collapsible" style="display:none;">Hide</a><div id="collapse-75a4b4c8" class="collapsed-text" style="display:none;"><pre>
$ 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)
</pre></div></p>
<p>The workaround is described in <a class="issue tracker-1 status-10 priority-4 priority-default" title="Defect: db migrate error from old version to 2.6 (Needs feedback)" href="https://www.redmine.org/issues/19174#note-3">#19174#note-3</a>.</p> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=625322015-03-25T15:28:45ZToshi MARUYAMA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-1 priority-4 priority-default" href="/issues/19173">Defect #19173</a>: Trac Migrate Script with Redmine 3.0</i> added</li></ul> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=625362015-03-25T15:30:19ZToshi MARUYAMA
<ul><li><strong>Related to</strong> deleted (<i><a class="issue tracker-1 status-1 priority-4 priority-default" href="/issues/19173">Defect #19173</a>: Trac Migrate Script with Redmine 3.0</i>)</li></ul> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=625602015-03-26T10:41:53ZToshi MARUYAMA
<ul><li><strong>Subject</strong> changed from <i>500 Internal error: NoMethodError</i> to <i>db migrate error from old version to 2.6</i></li></ul> Redmine - Defect #19174: db migrate error from old version to 2.6https://www.redmine.org/issues/19174?journal_id=1059262022-03-16T08:43:24ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/36766">Defect #36766</a>: Database migration from Redmine 0.8.7 or earlier fails</i> added</li></ul>