berkes
berkes

Reputation: 27543

rake db:migrate manually providing one file with migration

Somehow my test environment forgot to copy over several migrations. In order to troubleshoot, I want to call certain migration files by hand.

Is there a rake db:migrate option or trick that allows me to pass in a directory full of migrations that should be ran? Or even a specific migration file that will be ran?

These migrations are not present under db/migrate/, but rather in another gems' migration folder (/home/ber/.rvm/gems/ruby-1.8.7-p302@xxx/gems/spree_auth-1.0.0/db/migrate/).

Upvotes: 3

Views: 4389

Answers (2)

Shahin
Shahin

Reputation: 2787

try running this

rake db:migrate:status

you will find a table with all your migrations

choose the version you would like to migrate or unmigrate then

rake db:migrate VERSION=201853073732  

Notice that this won't work if you are stuck in mid migrations if you are you have to comment out the lines that were already migrated Good luck

Upvotes: 2

ScottJShea
ScottJShea

Reputation: 7111

If you generate your migrations with a specific version then this post will help you with that.

From post:

rake db:migrate:up VERSION=20090408054532

Where VERSION= is set to whatever comes from your generation.

Upvotes: 6

Related Questions