--- a/cubicweb/server/schema2sql.py Fri Jul 08 10:17:14 2016 +0200
+++ b/cubicweb/server/schema2sql.py Fri Jul 08 10:17:42 2016 +0200
@@ -168,11 +168,8 @@
"""Return (constraint name, constraint SQL definition) for the given relation definition's
constraint. Maybe (None, None) if the constraint is not handled in the backend.
"""
- eschema = rdef.subject
attr = rdef.rtype.type
- # XXX should find a better name
- cstrname = 'cstr' + md5((eschema.type + attr + constraint.type() +
- (constraint.serialize() or '')).encode('ascii')).hexdigest()
+ cstrname = constraint.name_for(rdef)
if constraint.type() == 'BoundaryConstraint':
value = constraint_value_as_sql(constraint.boundary, dbhelper, prefix)
return cstrname, '%s%s %s %s' % (prefix, attr, constraint.operator, value)