Database column conventions

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs