[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Phpgroupware-developers] SQL Style Guide available
From: |
Michael Dean |
Subject: |
RE: [Phpgroupware-developers] SQL Style Guide available |
Date: |
07 May 2003 20:26:23 -0500 |
On Wed, 2003-05-07 at 08:10, Kai Hofmann wrote:
> I am sorry to say - the "phpgw_" is redundant here and has no helpful
> meaning also
> having the prefix on all column names will make the whole thing more
> readable and
> it is more helpful for documentation purposes of the db schema.
It's not redundant. It is to allow phpGW to live along with other apps
in the same database. Not everyone has the option of one database per
application.
> > > A special trick that is very useful sometime are self
> > referencing tables
> > > (for example nested categories).
> > > In such a case you must rename the foreign key because it
> > can not have the
> > > same name as the primary key.
> > >
> > > categories
> > > ----------
> > > cat_id INT
> > > cat_name VARCHAR(32)
> > > cat_parent INT (reference to cat_id)
> >
> > cat_parent_id would be better in this case.
>
> Normally this would be true, but for self referencing tables this might
> irritate some developers so that they think there are two primary keys.
>
I disagree. If you're truly interested enough to look at the schema,
you should also examine the primary key, indexes, constraints, etc. _id
leaves no doubt what the information in the field is intended to
represent.
Either way, it's not critical since the information is internal by
nature.
Mike
RE: [Phpgroupware-developers] SQL Style Guide available, Kai Hofmann, 2003/05/07