<p>The migration should use the new date stamped format, not the old serial number format for the name - if you use <code>rails g migration</code> to create new migrations then it will take care of that.</p>

<p>Rather than having to hold lists of all the changesets and traces in memory in the migration I would suggest doing something like this:</p>

<div class="highlight"><pre><span class="no">Changeset</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="ss">:user_id</span><span class="p">)</span><span class="o">.</span><span class="n">pluck</span><span class="p">(</span><span class="ss">:user_id</span><span class="p">)</span><span class="o">.</span><span class="n">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">user_id</span><span class="o">|</span>
  <span class="no">User</span><span class="o">.</span><span class="n">reset_counters</span><span class="p">(</span><span class="n">user_id</span><span class="p">,</span> <span class="ss">:changesets</span><span class="p">)</span>
<span class="k">end</span>
</pre></div>

<p>and the equivalent for traces. That way only an array of user ids will need to be held in memory.</p>

            <p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">
              —<br>
              Reply to this email directly or <a href='https://github.com/openstreetmap/openstreetmap-website/pull/61#issuecomment-7595886'>view it on GitHub</a>.
            </p>
            <img src='https://github.com/notifications/beacon/uTRSc6ihLa7Shf84BpiOpvtkR4XBy71pbVen3qyrS7RtjVCRmQ06gzJknoPWPsln.gif' height='1' width='1'>