Is there (necessary) redundancy in the Add x to y migration format?
To add a phone column to the tickets table, I can write:
ruby script/generate migration AddPhoneToTickets phone:string
There seems to be redundancy here. But is it necessary?
Are we repeating ourselves by requiring the "phone" to be specified both by the migration name ( AddPhoneToTickets
) and by the column definition ( phone:string
)?
+1
a source to share
1 answer
You do not need to include a phone number in the migration name. For example, if you add a bunch of contact fields, you can just as easily name it AddContactFieldsToTickets
and specify all the fields. It's not specific enough to use the migration name for anything other than the table name, really.
+2
a source to share