schemas/bootstrap.py
branchstable
changeset 6208 07b176640a8c
parent 5782 8ff48d1a319f
child 6209 e3e5870807e9
--- a/schemas/bootstrap.py	Fri Sep 10 15:09:31 2010 +0200
+++ b/schemas/bootstrap.py	Fri Sep 10 16:48:58 2010 +0200
@@ -154,6 +154,17 @@
     value = String(description=_('depends on the constraint type'))
 
 
+class CWUniqueTogetherConstraint(EntityType):
+    """defines a sql-level multicolumn unique index"""
+    __permissions__ = PUB_SYSTEM_ENTITY_PERMS
+    constraint_of = SubjectRelation('CWEType', cardinality='1*', composite='object',
+		   	            inlined=True)
+    relations = SubjectRelation(('CWAttribute', 'CWRelation'), cardinality='+*',
+                                 constraints=[RQLConstraint(
+           'O from_entity X, S constraint_of X, O relation_type T, '
+           'T final TRUE OR (T final FALSE AND T inlined TRUE)')])
+
+
 class CWConstraintType(EntityType):
     """define a schema constraint type"""
     __permissions__ = PUB_SYSTEM_ENTITY_PERMS