https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292022-03-16T08:11:30ZRedmineRedmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059222022-03-16T08:11:30ZC S
<ul></ul><p>Hi there,<br />Unfortunately, I can't help you directly, but my approach to problems like this is to try not to upgrade in such big steps. I would try upgrading to version 1.2 first... <a class="external" href="https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade/46">https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade/46</a></p> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059252022-03-16T08:43:24ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-10 priority-4 priority-default" href="/issues/19174">Defect #19174</a>: db migrate error from old version to 2.6</i> added</li></ul> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059272022-03-16T09:08:13ZGo MAEDA
<ul></ul><p>Could you check if changing <code>app/models/member_role.rb</code> as follows fixes the problem?</p>
<pre><code class="diff syntaxhl"><span class="gh">Index: app/models/member_role.rb
===================================================================
</span><span class="gd">--- app/models/member_role.rb (リビジョン 21454)
</span><span class="gi">+++ app/models/member_role.rb (作業コピー)
</span><span class="p">@@ -69,7 +69,7 @@</span>
def add_role_to_subprojects
member.project.children.each do |subproject|
<span class="gd">- if subproject.inherit_members?
</span><span class="gi">+ if subproject.try(:inherit_members?)
</span> child_member = Member.find_or_new(subproject.id, member.user_id)
child_member.member_roles << MemberRole.new(:role => role, :inherited_from => id)
child_member.save!
</code></pre> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059282022-03-16T14:22:55ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/28947">36766.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/28947/36766.patch">36766.patch</a> added</li></ul><p>The reason the error occurs is that when executing migration 20090503121505_populate_member_roles.rb, the callback for the MemberRole model attempts to access columns in the projects table that are created in later migrations.</p>
<p>The problem can be fixed by replacing <code>Member.create!</code> with <code>Member.insert!</code> in the migration to avoid extra callback execution.</p> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059292022-03-16T16:06:56ZBernhard Kotzur
<ul></ul><p>Hello Go MAEDA,</p>
<p>first thank you very much for your support!</p>
<p>Changing the app/models/member_role.rb as described above fixes the problem.<br />I was able to migrate the db without any further errors.</p>
<p>Now I see you provide a 36766.patch for this issue.<br />What is the best way for further migrations? Apply the 36766.patch or edit the app/models/member_role.rb file or both?</p>
<p>Thanks in advance.</p> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059302022-03-16T23:25:53ZGo MAEDA
<ul></ul><p>Bernhard Kotzur wrote:</p>
<blockquote>
<p>Now I see you provide a 36766.patch for this issue.<br />What is the best way for further migrations? Apply the 36766.patch or edit the app/models/member_role.rb file or both?</p>
</blockquote>
<p>Applying the 36766.patch is better. That is the fundamental measure. Changes for app/models/member_role.rb is just a quick workaround.</p> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059312022-03-16T23:35:07ZGo MAEDA
<ul><li><strong>Subject</strong> changed from <i>db migrate error from 0.8.7 version to 4.1.1</i> to <i>Database migration from Redmine 0.8.7 or earlier fails</i></li><li><strong>Target version</strong> set to <i>4.1.7</i></li></ul><p>Setting the target version to 4.1.7.</p> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059572022-03-18T02:07:21ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Resolved</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1059672022-03-18T17:40:52ZMarius BĂLTEANU
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/105967/diff?detail_id=86054">diff</a>)</li></ul> Redmine - Defect #36766: Database migration from Redmine 0.8.7 or earlier failshttps://www.redmine.org/issues/36766?journal_id=1060312022-03-20T08:24:51ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul><p>Committed the fix.</p>