MySQL migration: trying to create "not null" boolean column (RoR 2.0)

Hello everyone!

Disclaimer: I am really, really new to Rails and this is probably a
really stupid question, but I have spent SO LONG trying to find an
answer and I’ve gotten nowhere. Thanks in advance for indulging me!

I’m trying to set up a boolean column in my database through db/
migrate/001_create_(whatever).rb. Here’s the relevant line:

t.boolean :type

When I use db:create:all to create the MySQL databases, it makes all
columns null, which is a problem for this column. I tried:

t.boolean :type, :null => false

but that didn’t work and I’m wondering if there’s a different way of
doing this in 2.0. Again, really sorry for the simple question but I
feel like I’ve looked everywhere! Help much appreciated!

db:create:all, should just create your databases (development, test
and production). db:migrate should create your (whatever) table from
your 001_create_(whatever).rb.

i am not sure if this is what you are wanting but try the “default”
option… this way your column will always have a value…

t.boolean :type, :default => true, :null => false
t.boolean :type, :default => false, :null => false

let us know if this does not help…