rake redo??

If a rake db:migrate succeeds but you realise it is not what you want then the thing to do is ‘rake db:rollback’ which will run the ‘down’ part of the previous migration and so should take you back to where you were. Then correct the migration and run it again.

If a migration fails, however, you must manually undo any changes made before the error, correct the code and migrate again. Do not do a rollback in this case as it will go back to the one before you started, if you understand me. At least this is the case on MySQL which does not handle transactions which include changes to db structure. I am not sure whether the situation is different with other db types.