I want to know if I can pass a default value to the rails g migration
command. Something like:
$ rails generate migration add_disabled_to_users disabled:boolean:false #where false is default value for disabled attribute
in order to generate:
class AddDisabledToUsers < ActiveRecord::Migration
def change
add_column :users, :disabled, :boolean, default: false
end
end
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