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.

Colin

2009/5/20 Mk 27 <[email protected]>

>
> Being someone who likes to write code and do everything myself this
> rails deal has me grinding my teeth, but I will get over it.
>
> I just noticed after doing a "rake db:migrate" that I mispelled a
> method/column name.  So before doing anything else, I corrected the
> spelling in the relevant db/migrate .rb file and ran "rake db:migrate"
> again hoping that would do.  However, looking in the db/schema.rb file,
> nothing had changed.  So I erased that and the database and tried rake
> again and hopefully everything is fine BUT that is hackish, to say the
> least.
>
> I've only glanced through the rake docs, --help, etc, and can't find
> anything pertinent to the issue.  Anyone nice wanna explain quick?
>
> The other part of my question: does rake affect anything outside db/ ?
> If not, everything should be hunky dory.
>
> Right?
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to