[Maypole] Maypole::Plugin::Relationships and YAML
Dana Hudes
dhudes@hudes.org
Tue, 1 Feb 2005 20:25:23 -0500 (EST)
On Wed, 2 Feb 2005, Tony Bowden wrote:
> On Tue, Feb 01, 2005 at 06:17:21PM -0500, Dana Hudes wrote:
> > From a documentation perspective, if I have a PK that I then use as a FK
> > somewhere, gosh but it makes life so much clearer to use the same name.
>
> Why? I don't buy this one.
If you name the PK clearly and distinctively you can keep the name
>
> I find it much clearer to make FKs the name of the table to which they
> refer.
If the PK name includes the table name
>
> I also find it much simpler to just make the PK of every table be called
> 'id'.
>
> But I'm also a huge believer in the principle that Primary Keys should
> always be meaningless.
But they're not meaningless! Sure, sometimes -- even often -- its
suitable to have a pure number from a sequence. I've had systems in the
past where part number was coded. There could be a sequence as -part- of
the pn but it had other fields which meant something. In particular, this
was a manufacturer of cable trays. Parts could be the tray, a bolt, a
strap or other kinds of hardware. Trays had a number, bolts a number and
so on. Then you have the particular kind of tray or bolt (perhaps coated
with something, and you would then have particular kinds of coating with
their own particular meaning including uncoated as a kind of coating).
Length of part could be directly represented in the number as well.