We have script/generate migration add_fieldname_to_tablename fieldname:datatype
syntax for adding new columns to a model.
On the same line, do we have a
Another way to change data type using migration
step1: You need to remove the faulted data type field name using migration
ex:
rails g migration RemoveFieldNameFromTableName field_name:data_type
Here don't forget to specify data type for your field
Step 2: Now you can add field with correct data type
ex:
rails g migration AddFieldNameToTableName field_name:data_type
That's it, now your table will added with correct data type field, Happy ruby coding!!