This project is archived and is in readonly mode.

#4120 ✓invalid
Josh Susser

rake db:migrate skips migrations with older version numbers than current

Reported by Josh Susser | March 6th, 2010 @ 11:43 PM

Not sure if this is considered a bug, but the behavior is surprising enough that I think it's worth changing. When using timestamped migration version numbers, running db:migrate doesn't run migrations with versions less than the highest previously applied migration. Here's an example using small integers rather than big timestampy numbers:

  1. Start with migration versions in the db/migrate directory: 1, 2, 5, 7, 10, 12.
  2. run rake db:migrate # => runs all migrations
  3. Add migrations to directory with versions: 6, 8, 15, 16.
  4. run rake db:migrate # => migrations 15 & 16 are run, but 6 & 8 are skipped.

I think it is less surprising to run all the migrations, not just the ones with the version number > 12.

I can do a patch for this if people think it's the right thing to do.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Tags

Pages