Re: Foreign key as primary key...
[prev]
[thread]
[next]
[Date index for 2005/02/20]
--- Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:
> On Sun, Feb 20, 2005 at 01:42:52PM +0000, fdsfds
> fdsfddsf wrote:
> > An example would be three tables:
> >
> > System:
> > ID [PK]
> > Title
> > Text, etc.
> >
> > SystemType:
> > ID *[PK/FK refers to System table]
> > Type
> > Name, etc.
>
> Looks like two tables rather than three, to me ...
>
> > So in System.pm I declare the following -
> > System->columns(Primary => qw/ID/);
> > System->has_many(types => 'SystemType');
>
> > In SystemType.pm I declare -
> > System->columns(Primary => qw/ID/);
> > System->might_have(ID => 'System');
>
> I would have
>
> System->columns(All => qw/id title text .../);
> System->might_have(_type => SystemType => qw/type
> name.../);
>
> SystemType->columns(All => qw/id type name.../);
>
>
> Tony
Opps! Yes it is just two, I was going to get more
involved, but I thought it probably wasn't wise for
the sakes of clarity. Many thanks for this Tony, I
shall give it a shot!
>joss
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
|
(message missing)
|