hooks/syncschema.py
changeset 4043 39ae94e0c8b8
parent 4042 f85a4c846aad
child 4052 0c39ffd789ed
--- a/hooks/syncschema.py	Tue Dec 08 16:41:43 2009 +0100
+++ b/hooks/syncschema.py	Tue Dec 08 16:45:01 2009 +0100
@@ -57,6 +57,13 @@
         constraints.append(cstr)
     return constraints
 
+def group_mapping(cw):
+    try:
+        return cw.transaction_data['groupmap']
+    except KeyError:
+        cw.transaction_data['groupmap'] = gmap = ss.group_mapping(cw)
+        return gmap
+
 def add_inline_relation_column(session, etype, rtype):
     """add necessary column and index for an inlined relation"""
     table = SQL_PREFIX + etype
@@ -811,7 +818,8 @@
             sampletype = rschema.subjects()[0]
             desttype = rschema.objects()[0]
             props = rschema.rdef(sampletype, desttype)
-            relrqls += list(ss.rdef2rql(rschema, name, desttype, props))
+            relrqls += list(ss.rdef2rql(rschema, name, desttype, props,
+                                        groupmap=group_mapping(self._cw)))
         # now remove it !
         schema.del_entity_type(name)
         # create the necessary table