Andrew
Andrew

Reputation: 2168

rails migration one by one

Is there a possibility to run migrations one at a time?

I've got a bunch of migration files and the whole migration runs without problem on my local machine (which use PostgreSQL).

When I deploy (the server uses MySQL), the whole migration does not succeed.

Therefore, I'd like to reset the database and run migrations one by one to see where the inconsistency arises.

P.S. The problem seems to be with pluralization: script can not drop column order_id from table NNN, which in fact contain orders_id column.

Upvotes: 3

Views: 1301

Answers (2)

Thomas Klemm
Thomas Klemm

Reputation: 10856

Running migrations one by one is possible by passing a STEP=number parameter.

rake db:forward STEP=1 # edited as per Stefan's suggestion
rake db:rollback STEP=1

Upvotes: 0

Stefan
Stefan

Reputation: 114178

Rails 3.0 introduced rake db:forward which accepts a STEP parameter:

rake db:forward STEP=1

Upvotes: 11

Related Questions