I know how to add one column to an existing table. Now I have to add many columns to an existing table. Is there a shorter way for:
add_col1_col2_col3_col4_.._coln_to_tables col1:integer col2:integer etc...
Do I have to do the above for ALL the additional columns I have to add?
command to create new model and table with columns : rails g model ModelName col_name1:string col_name2:integer col_name3:text ... command to add more columns under existing table: rails g migration AddColumnToModelName col_name4:string col_name5:integer ...
No not necessary. You can do
Assuming TableName is user
rails g migration AddColumnsToUser col1:integer col2:integer .. etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With