I completely understand the difference between the up/down methods and the change methods, but I don’t understand why rails seems to generate one over the other.
I’ve just run the following command and gotten a change method:
rails generate migration AddUpdaterCreatorToRequest
About ten minutes ago I ran the following and got the up and down methods:
rails generate migration AddClientPrimaryEngineer
What gives? Both start with add (for a while I was wondering if there wasn’t some NLP like stuff going on…) is it ‘To’ that’s missing on the second to make it give me a change instead?
If Rails happens to successfully parse the migration name and it will be able to generate the code for you, it will use the
changemethod. Otherwise it will just fallback toup/downmethods and let you fill the pieces.I think the second migration name should be CreateClientPrimaryEngineer.