Reversible migration for change_column_default from not having any default in Rails

前端 未结 7 2227
青春惊慌失措
青春惊慌失措 2021-02-18 21:34

The Rails guides to active record migrations says that you can do

change_column_default :products, :approved, from: true, to: false

I\'ve got a

7条回答
  •  不知归路
    2021-02-18 22:23

    If you have an issue with migration file, Change your migration to this format.

    change_column_default :table_name, :column_name, from: nil, to: "something"
    

提交回复
热议问题