开发者

How do I add a default value to a field in a RoR migration?

开发者 https://www.devze.com 2023-01-14 02:32 出处:网络
How do I add a default value to an exi开发者_JAVA技巧sting field in a RoR migration?I think this would do the trick

How do I add a default value to an exi开发者_JAVA技巧sting field in a RoR migration?


I think this would do the trick

change_column :users, :active, :boolean, :default => 1

Use the same data type as when you created the column but add the default parameter.

0

精彩评论

暂无评论...
验证码 换一张
取 消