5
我的用户模型的样子:的最佳方式
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :name
t.string :email
t.timestamps
end
end
def self.down
drop_table :users
end
end
如果我想补充一点:属性,是它最好创建另一个迁移文件添加一个新列(see another Stackoverflow thread)或者我可以手动添加t.string:name_of_new_attribute然后耙db:migrate?
谢谢!
因此,当我想在将来添加更多属性时,我可以简单地编辑此迁移文件吗? – Elias7 2012-04-16 04:42:05
您最好使用其中的新属性创建另一个迁移 – Norto23 2012-04-16 04:43:48