我的用户模型如下:
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
如果我想添加一个新的 :attribute,是否最好创建另一个迁移文件来添加新列(参见 Stackoverflow 线程) 或者我只需要手动添加 t.string :name_of_new_attribute 并运行 rake db:migrate?谢谢!