On 1/20/07, A. Pagaltzis <[EMAIL PROTECTED]> wrote:
Ugh, yeah, not my intent at all. This scheme is in fact carefully
chosen to avoid redundant information. F.ex. most people name
their FK columns something like `${othertable}_id` – but the only
purpose the `_id` bit serves is to call out the column as an FK.
It doesn't have any descriptory value of its own. That's not so
bad as long as you don't have multiple FKs to the same table in
one table, but if you need to, those `_id` bits become really
obvious clutter.

I don't really agree with that. I think the "id" suffix in e.g.
"user_id" describes exactly the data that field contains: an user id.
It doesn't really contain the actual user object - which can be
fetched through the relationship "user".

Note that it doesn't mean that "user" (i.e. the prefix) should always
be the name of the referenced table. In that posts example you could
use a field called "author_id" which would reference an user. No
problem with that since your intent would be clear when describing the
relationship.

-Nilson Santos F. Jr.

_______________________________________________
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