[BioSQL-l] Phylodb: unique key constraint on tree

Hilmar Lapp hlapp at gmx.net
Sun Jun 10 14:41:11 UTC 2007


Hi all -

the unique key constraint on tree has been the name. With the  
addition of a mandatory namespace for trees, this doesn't really make  
sense to keep that way.

Instead, I propose to change this to names having to be unique only  
within a namespace. I.e., the unique key constraint would be on  
(name, biodatabase_id).

Let me know if you have any comments, suggestions, or concerns.

As we are starting to use the module with real data, there are likely  
going to be a few more changes to the schema. For those who are using  
the schema already, feel free to wait it out until the module  
stabilizes, and I will also try to provide a migration path whenever  
possible. Feel free to apply these immediately, or to accumulate them.

The migration path for this change is:

-- this assumes the default naming scheme for constraints used by  
PostgreSQL
ALTER TABLE tree DROP CONSTRAINT tree_name_key;
-- let's move towards named constraints to avoid having to rely on  
whatever
-- naming scheme an RDBMS employs (which may change anyway)
ALTER TABLE tree ADD CONSTRAINT tree_c1 UNIQUE (name, biodatabase_id);

	-hilmar
-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================








More information about the BioSQL-l mailing list