嗨我有一个表格,其中有两列来自和来自类型datatime我希望将数据类型从datetime更改为date.我不知道像rails g这样的迁移中的chagning列类型的确切命令
从命令行运行:
rails generate migration change_data_type_for_table_column
将您的迁移写为:
change_table :table do |t|
t.change :column, :type
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4381 次 |
| 最近记录: |