Re: variation of "weak link" lookup table

[prev] [thread] [next] [Date index for 2004/06/24]

From: Tony Bowden
Subject: Re: variation of "weak link" lookup table
Date: 07:23 on 24 Jun 2004
On Wed, Jun 23, 2004 at 08:47:05PM -0500, step2@xxxxxxxxxxxxxxxx.xxx wrote:
> artist ( artistid, name )
> artistaliast ( artistid1, artistid2 )

> ArtistAlias->table('artistalias');
> ArtistAlias->columns(Primary => qw/artistid1 artistid2/);
> ArtistAlias->has_a(artistid1 => 'Artist');
> ArtistAlias->has_a(artistid2 => 'Artist');

> Artist->table('artist');
> Artist->columns(Primary => 'artistid');
> Artist->columns(All => qw/artistid name/);
> Artist->has_many(tracks => ['TrackArtist' => 'trackid']);
> Artist->has_many(aliases => ['ArtistAlias' => 'artistid1']);

I'm not sure that that last line is correct. As you've multiple columns
pointing to the same table in ArtistAlias you're going to need the 3rd
argument to has_many. I would have thought that you'll want:

 Artist->has_many(aliases => ['ArtistAlias' => 'artistid2'], 'artistid1');

Tony

variation of "weak link" lookup table
step2 01:47 on 24 Jun 2004

Re: variation of "weak link" lookup table
Tony Bowden 07:20 on 24 Jun 2004

Re: variation of "weak link" lookup table
steve shapero 08:09 on 24 Jun 2004

Re: variation of "weak link" lookup table
merlyn (Randal L. Schwartz) 15:10 on 24 Jun 2004

Re: variation of "weak link" lookup table
steve shapero 18:43 on 24 Jun 2004

Re: variation of "weak link" lookup table
Tony Bowden 07:23 on 24 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52