[Dbix-class] Newbie - database structure

Ashley apv at sedition.com
Fri Feb 22 17:30:22 GMT 2008


On Feb 22, 2008, at 9:20 AM, Dermot wrote:

> What happens if you extend the schema so that you included, say  
> editors. Would you create a new join table or have add a field to  
> the join table.
> Thanx,
> Dp.

Maybe but I'd be inclined to make "author" into a "person" table and  
add another table for contributing roles. The same person can be  
listed as an author and an editor for a work; two tables means you  
end up with duplicate records for the same person in editor and  
author. If you want to join arbitrary persons to a work, just make a  
"persons" table and a table designating their contributing role in in  
the work. Look for ways to generalize or abstract the specifics you  
find yourself naturally inclined to attach to a record. If you find  
yourself duplicating information in a database, you're probably doing  
something wrong.

table contributing_role
   person (fk to person.id)
   work (fk to book.id, or movie.id, or recording.id…?)
   role "Editor"
   desc …


-Ashley




More information about the DBIx-Class mailing list