Forum: Ruby on Rails Database column conventions

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2006-01-23 17:24
I've got a database with about 25 tables and growing.  I was wondering
what conventions people use with rails for the columns regarding NOT
NULL and DEFAULT values.

I realize this depends a lot on the data being stored, but after
entering dozens of columns into the database, you have to come up with
your 'default' case, right?

Generally, I just do NOT NULL DEFAULT '0' (for ints, floats, and so on)
or NOT NULL DEFAULT '' (for text, varchar).  Having the NOT NULL, I
would think makes coding a bit easier since you don't have to test for
nil?, right?

So I'm curious -- what's your 'default' column look like and why?

This topic is locked and can not be replied to.