Hi I just created a database in RoR. I now want to add 10 more columns to it. However, I dont want to use the following type of command that adds only 1 column at a time:
rails generate migration AddClosing_Hrs1ToBusinesses closing_hrs1:string
Is there a way to add multiple columns to my database without having to type a command for each column individually like above?
To add multiple columns to a table, separate field:type pairs with spaces when using rails generate migration command.
You can specify your column names all in one go
rails generate migration AddClosing_Hrs1ToBusinesses closing_hrs1:string new_cloumn:string third_column:string
Documentation : http://guides.rubyonrails.org/migrations.html
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