[jifty-devel] db relations

Michael Gee gee.24 at osu.edu
Fri May 12 15:02:09 EDT 2006

Hi list,

Could someone please give me a quick pointer in how to setup some  
table relationships with the DB schema.  For instance a column that  
holds a foreign key (a primary index in another table).  I'd like to  
set up some HAS_A & HAS_MANY relationships.

I see a note about the method: refers_to() in the docs, but I'd track  
down the usage of that method, or where in my code I would call it.


Regarding my message from yesterday:

I made one small change to my copy of Jifty::DBI::SchemaGenerator to  
specify default values for columns other than 'text':

         push @cols,
             {   name     => $column->name,
                 type     => $column->type,
                 null     => $column->mandatory ? 0 : 1,
                 ( $column->type eq 'text'
                     ? ()
                     : (default  => $column->default)

I make no claims that this correct or complete in general, but it  
works for me.

Michael Gee
Learning Technology Developer
Introductory Biology Program
The Ohio State University
4056 Smith Laboratory
174 W. 18th Ave.
Columbus, OH  43210

Voice: (614) 247-6576
   Fax: (614) 292-4390


More information about the jifty-devel mailing list