For many operations rails can guess what is the inverse operation (without problems). For example, in your case what is the reverse operation of add_column
to call when you rollback? Of course it’s remove_column
. What is the inverse of create_table
? It’s drop_table
. So in these cases rails know how to rollback and define a down
method is superfluous (you can see in the documentation the methods currently supported from the change method).
But pay attention because for some kind of operation you still need to define the down
method, for example if you change the precision of a decimal column how to guess the original precision on rollback? It’s not possible, so you need to define the down
method.
As said, I suggest you to read the Rails Migrations Guide.