Creating RubyOnRails migrations also allow us to rollback an migration after executing it.
Two common ways to write migrations is either using
def change which is the default from Rails by the way,
def up and
def change, Rails is smart enough and tries to rollback automatically. And of course if you have
something crazy like a raw query on your migration, you can use the old school
Basically, you just need to get the timestamp that it is usually on the migration’s filename and run:
bundle exec rake db:migrate:redo VERSION=20180330164947
Another alternative is reset your db everytime you make a mistake. In dev mode it is still OK, but taking advantage on core features is even better.
<< All Posts
Speed up mysql import on MacOS