ruby script/generate migration add_column_to_model column_name:column_type
rake db:migrate
如果需要删除某些字段,应该是:
ruby script/generate migration remove_column_from_model column:column_type
新建表
ruby script/generate Model account_area employee_id:integer branch_office_id:integer
后添加索引
ruby script/generate migration add_model_index_to_product
https://www.jb51.net/article/51501.htm
网友评论