mardi 24 mai 2016

default value is not saved to the database

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 is still 'nil'. The value '1' I added is not saved. Please show me how to solve this. Thanks.

Aucun commentaire:

Enregistrer un commentaire