Can I pass default value to rails generate migration?

后端 未结 4 915
执念已碎
执念已碎 2020-12-29 19:39

I want to know if I can pass a default value to the rails g migration command. Something like:

 $ rails generate migration add_         


        
4条回答
  •  情书的邮戳
    2020-12-29 20:05

    You can't: https://guides.rubyonrails.org/active_record_migrations.html#column-modifiers

    null and default cannot be specified via command line.

    The only solution is to modify the migration after it's generated. It was the case in Rails 3, still the case in Rails 6

提交回复
热议问题