问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/9550181/how-to-add-several-columns-to-a-database-in-rails