title: Rails pending migration in rake db:test:prepare
body: <p>I've run <code>rake db:migrate</code> and all of my migrations ran.  However, when I try to run <code>rake db:test:prepare</code> I get the error:</p>
  
  <pre><code>You have 1 pending migrations:
    20130724211328 CreateGalleries
  Run `rake db:migrate` to update your database then try again.
  </code></pre>
  
  <p>Then running <code>rake db:migrate</code> again gives the error:</p>
  
  <pre><code>PG::Error: ERROR:  relation "galleries" already exists...
  </code></pre>
  
  <p>But in the console I can create and manipulate the Gallery model exactly as shown in the CreateGalleries migration.  The table is not being created or even mentioned in any other migrations.</p>
  
  <p>It seems the migration ran just fine but did not register.  Any ideas how to fix this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I solved this with <code>rake db:drop db:create db:migrate</code> then <code>rake db:test:prepare</code>, but I'm happy to give the solution to anyone who can shed light on what caused the problem in the first place.</p>