rails migrations: what are the advantages of “up” and “down” versus “change”?

Advantages of having an "up" and a "down" method in a migration file over doing a migration via a "change" method.

As I understand this, change method knows how to reverse itself automatically. Up does not so you have to specify reverse functionality by yourself in down method.

Automatical reversing comes with downsides as it does not know how to reverse all the available migration calls. Source for this and full list of auto reverse methods is available in the official docs here.

To more clearly answer your question - advatage of "up" and "down" over "change" is being able to have fine control over the way migration gets executed and reverted. Bare in mind this does not mean you can't do all your migrations with up/down or that it's deprecated but you lose out on the conveniece provided by "change". For summary:

  • Change - For majority of migrations
  • Change + reversible - For some complexity not supported by "change" method"
  • up/down - For fine control. Very nieche, custom or complex migrations.