[migration] fix crash when adding symmetric relation type stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 06 Aug 2010 17:35:02 +0200
branchstable
changeset 6073 bf684f1022bf
parent 6072 9d83b214066a
child 6074 f2580c7abc26
[migration] fix crash when adding symmetric relation type
server/migractions.py
--- a/server/migractions.py	Fri Aug 06 17:34:24 2010 +0200
+++ b/server/migractions.py	Fri Aug 06 17:35:02 2010 +0200
@@ -911,10 +911,15 @@
             self.commit()
             gmap = self.group_mapping()
             cmap = self.cstrtype_mapping()
+            done = set()
             for rdef in rschema.rdefs.itervalues():
                 if not (reposchema.has_entity(rdef.subject)
                         and reposchema.has_entity(rdef.object)):
                     continue
+                # symmetric relations appears twice
+                if (rdef.subject, rdef.object) in done:
+                    continue
+                done.add( (rdef.subject, rdef.object) )
                 self._set_rdef_eid(rdef)
                 ss.execschemarql(execute, rdef,
                                  ss.rdef2rql(rdef, cmap, gmap))