* Matt S Trout <[EMAIL PROTECTED]> [2007-01-22 15:10]:
> Using only the table name is kinda foolish because it screws
> you when you have multi-col PKs.

Granted; I haven’t had such a case though. :-)  I think it’s
good practice to use surrogate keys in any case were you’re not
absolutely and completely certain that the key can positively
never ever ever change. Since I also haven’t had to use legacy
schemata, my only multi-col PKs have been (FK,FK) pairs in join
tables. And my surrogate key column is always called `id`, which
I wouldn’t bother mentioning in any case.

If I did have a multi-col PKs I’d want to refer to, I guess I’d
opt for also including the FK column name. But I wouldn’t drop
the extra label describing the relationship, so I’d end up with
`foo.author_user_asdf` referencing `user.asdf`. (Maybe I’d use a
double underscore to delimit the relationship from the referee or
something; not sure.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to