Reversible migration for change_column_default from not having any default in Rails

前端 未结 7 2229
青春惊慌失措
青春惊慌失措 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:06

    As of Oct 2016, This feature (using to: and from: for change_column_default to be reversible) is now available on the 5.x branch. Unfortunately it's not available 4.2.x or lower. :(

    Verification: git tag --contains f9c841927ac3d1daea2a9cebf08b18e844e5eec5 in the rails project.

提交回复
热议问题