[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Phpgroupware-developers] SQL Style Guide available
From: |
Kai Hofmann |
Subject: |
RE: [Phpgroupware-developers] SQL Style Guide available |
Date: |
Wed, 7 May 2003 15:10:51 +0200 |
Dear Michael,
> > Each column of a table must start with a shortened version
> of the table name
> > with
> > a maximum of 6 characters. For example use
>
> This should only apply to fields that will be used a foreign keys in
> other tables. For example, if you have a project that is
> referenced, it is best to use
>
> Source: phpgw_project.project_id
> Ref: phpgw_task.project_id
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.
> > 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.
Greetings
Kai
P.S.: I will add your suggestions to the guide - thanks :)
--
***** Open Source und Linux im professionellen Einsatz *****
** komplexe Mailserver, Groupware, Office: sprechen Sie uns an **
Dipl.-Inform. Kai Hofmann Team Softwarelösungen
pro|business AG, EXPO Plaza 1 (Deutscher Pavillon), 30539 Hannover
E-Mail: address@hidden, Tel.: 0511/60066-332, Fax: -355
WWW: http://www.probusiness.de/
RE: [Phpgroupware-developers] SQL Style Guide available, Kai Hofmann, 2003/05/07