如何在Rails中向数据库添加几列
问题描述:
我刚刚在RoR中创建了一个数据库.现在,我想再添加10列.但是,我不想使用以下类型的命令,一次只添加1列:
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?
答
您可以一次性指定所有列名
You can specify your column names all in one go
rails generate migration AddClosing_Hrs1ToBusinesses closing_hrs1:string new_cloumn:string third_column:string