Why is rails setting ":null => false" on all my columns in schema.rb?
Posted
by ryeguy
on Stack Overflow
See other posts from Stack Overflow
or by ryeguy
Published on 2010-04-01T20:03:42Z
Indexed on
2010/04/01
22:43 UTC
Read the original article
Hit count: 216
ruby-on-rails
Even if I never specify :null => false
in my migrations that initially add columns to tables, rails still generates code in schema.rb
that specifies the columns as having :null => false
. Why is this? If I develop on my box, and then use rake db:schema:load
on my production box, I'm going to get very different behavior!
Edit: Even if I delete schema.rb
and run rake db:schema:dump
, it still puts :null => false
on the new schema even if it isn't defined like that in the actual database. It seems it can't tell whether or not a column is marked as allowing nulls. I'm using SQLite if that helps.
© Stack Overflow or respective owner