The intent of the original line was to add a new boolean column called 'active' and set the default value to true:
add_column :people, :active, :boolean, :default => true
This works fine on MySQL but with Postgresql the default value was not used on existing records. It appears that Postgresql sees that NULL is an acceptable value for the column and uses that as the value.
The way to fix this is to add a 'null' attribute to the call like this:
add_column :people, :active, :boolean, :default => true, :null => false
Now, running rake db:migrate sets all existing records to true
2 comments:
This just saved me from a mass of confusion. Thanks!
You can get better thing here
http://www.websterpandits.blogspot.com/
Post a Comment