[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] data integrity question
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] data integrity question |
Date: |
Fri, 28 May 2004 15:53:40 +0200 |
User-agent: |
Mutt/1.3.22.1i |
> If an org gets deleted, should its comm_channell entries also get
> deleted from the database,
One would tend to think that identical comm channels can be
linked from several orgs/identities. However, this is not the
case, or rather, one needs to set up a policy what to do when
a comm channel is to be changed. The options are:
1)
On insert create new.
On update update linked row.
On delete delete linked row.
2)
On insert link to existing.
On update copy-on-update and updated newly linked row.
On delete delete link but leave alone linked row.
It seems cleaner to use option 1. However, there's one
problem: PG does not support multi-table uniqueness (as would
be needed to make sure that any comm_channel is linked from
EITHER an org OR an identity. And from *one* of either, for
that matter.
However, if linked from more an org and an identity the delete
will fail due to foreign key references still in place.
I have added a few on update/delete statements to the
lnk_*2comm_channel tables, too.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346