diff -r 48402faff043 -r a84190d4e78c hooks/syncschema.py --- a/hooks/syncschema.py Thu Jan 13 12:34:17 2011 +0100 +++ b/hooks/syncschema.py Thu Jan 13 12:36:08 2011 +0100 @@ -705,14 +705,14 @@ syssource.update_rdef_unique(session, rdef) self.unique_changed = True + class CWUniqueTogetherConstraintAddOp(MemSchemaOperation): entity = None # make pylint happy def precommit_event(self): session = self.session prefix = SQL_PREFIX table = '%s%s' % (prefix, self.entity.constraint_of[0].name) - cols = ['%s%s' % (prefix, r.rtype.name) - for r in self.entity.relations] + cols = ['%s%s' % (prefix, r.name) for r in self.entity.relations] dbhelper= session.pool.source('system').dbhelper sqls = dbhelper.sqls_create_multicol_unique_index(table, cols) for sql in sqls: @@ -722,9 +722,10 @@ def postcommit_event(self): eschema = self.session.vreg.schema.schema_by_eid(self.entity.constraint_of[0].eid) - attrs = [r.rtype.name for r in self.entity.relations] + attrs = [r.name for r in self.entity.relations] eschema._unique_together.append(attrs) + class CWUniqueTogetherConstraintDelOp(MemSchemaOperation): entity = oldcstr = None # for pylint cols = [] # for pylint @@ -747,6 +748,7 @@ if set(ut) != cols] eschema._unique_together = unique_together + # operations for in-memory schema synchronization ############################# class MemSchemaCWETypeDel(MemSchemaOperation): @@ -1142,9 +1144,9 @@ schema = self._cw.vreg.schema cstr = self._cw.entity_from_eid(self.eidfrom) entity = schema.schema_by_eid(self.eidto) - cols = [r.rtype.name - for r in cstr.relations] - CWUniqueTogetherConstraintDelOp(self._cw, entity=entity, oldcstr=cstr, cols=cols) + cols = [r.name for r in cstr.relations] + CWUniqueTogetherConstraintDelOp(self._cw, entity=entity, + oldcstr=cstr, cols=cols) # permissions synchronization hooks ############################################