I want to add a default value to an existing column in my database, this is my attempt:
add_column :users, :gamelv1, :integer, default: 1
I added default: 1
and run rake db:migrate
, but when I check the default value of the gamelv1
column, it is still nil
. The value 1
I added is not saved.
How do I set default values for my column?