# HG changeset patch # User Sylvain Thénault # Date 1424856821 -3600 # Node ID 88577b10b31ec288db40df772bad7c7f1dc0b3c7 # Parent 480187dd66b3c5b0eebe922e9cba8d4f3a34efaa [schema] add a unique index on cwuri Closes #4985752 diff -r 480187dd66b3 -r 88577b10b31e entity.py --- a/entity.py Thu Feb 13 16:37:40 2014 +0100 +++ b/entity.py Wed Feb 25 10:33:41 2015 +0100 @@ -425,7 +425,7 @@ else: for rschema in cls.e_schema.subject_relations(): if (rschema.final - and rschema != 'eid' + and rschema not in ('eid', 'cwuri') and cls.e_schema.has_unique_values(rschema) and cls.e_schema.rdef(rschema.type).cardinality[0] == '1'): mainattr = str(rschema) diff -r 480187dd66b3 -r 88577b10b31e misc/migration/3.21.0_Any.py --- a/misc/migration/3.21.0_Any.py Thu Feb 13 16:37:40 2014 +0100 +++ b/misc/migration/3.21.0_Any.py Wed Feb 25 10:33:41 2015 +0100 @@ -19,3 +19,5 @@ commit() sync_schema_props_perms('CWEType') + +sync_schema_props_perms('cwuri') diff -r 480187dd66b3 -r 88577b10b31e schemas/base.py --- a/schemas/base.py Thu Feb 13 16:37:40 2014 +0100 +++ b/schemas/base.py Wed Feb 25 10:33:41 2015 +0100 @@ -23,7 +23,7 @@ from yams.buildobjs import (EntityType, RelationType, RelationDefinition, SubjectRelation, String, TZDatetime, Datetime, Password, Interval, - Boolean) + Boolean, UniqueConstraint) from cubicweb.schema import ( RQLConstraint, WorkflowableEntityType, ERQLExpression, RRQLExpression, PUB_SYSTEM_ENTITY_PERMS, PUB_SYSTEM_REL_PERMS, PUB_SYSTEM_ATTR_PERMS) @@ -164,6 +164,7 @@ cardinality = '11' subject = '*' object = 'String' + constraints = [UniqueConstraint()] # XXX find a better relation name @@ -183,7 +184,6 @@ cardinality = '?*' - class ExternalUri(EntityType): """a URI representing an object in external data store""" uri = String(required=True, unique=True, maxsize=256,