views:

90

answers:

2

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.

A: 

Reverting to ruby 1.8.7 did the trick for me.

No idea why though.

kouak
Out of curiosity, which sqlite lib were you using?
ryeguy
Don't know if this matters to you, but I fixed htis issue, see my answer.
ryeguy
I'll give it a try, thank you.
kouak
+2  A: 

I really hate that this was so subtle, but the problem was I was using the sqlite3 gem instead of sqlite3-ruby. As soon as I corrected it in environment.rb, everything was better.

ryeguy