[Cubicweb] creating multi column unique index in db

Sylvain Thénault sylvain.thenault at logilab.fr
Mon Sep 6 09:46:21 CEST 2010


On 02 septembre 08:29, Alexandre Fayolle wrote:
> I've started working on this yesterday. 
> 
> What I'm moving towards is:
> 
> * in yams, a new attribute of EntityType classes called __unique_together__ 
> (name suggested by Adrien, after something similar in Django), which is a list 
> of tuple of rtypes : each tuple is made into an unique index. 
> 
> * in cubicweb, two additional migration commands, 
> add/drop_unique_together_attrs, which can be used to add the indexes in 
> migration scripts. 

migration should actually be handled by looking for addition/removal of
such constraint in hooks (see cw.hooks.syncschema) and doing relevant database
modification there.

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org




More information about the Cubicweb mailing list