[migration] when adding a cube, skip infered relations (closes #3005576) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 22 Jul 2013 10:55:45 +0200
branchstable
changeset 9164 4415209bea0a
parent 9163 fe4c1c1982e7
child 9165 7ebf3b1cdb4c
[migration] when adding a cube, skip infered relations (closes #3005576) Skipped infered relations are recalculated later.
server/migractions.py
--- a/server/migractions.py	Thu Jul 11 17:40:28 2013 +0200
+++ b/server/migractions.py	Mon Jul 22 10:55:45 2013 +0200
@@ -688,7 +688,10 @@
         for rschema in newcubes_schema.relations():
             existingschema = self.repo.schema.rschema(rschema.type)
             for (fromtype, totype) in rschema.rdefs:
-                if (fromtype, totype) in existingschema.rdefs:
+                # if rdef already exists or is infered from inheritance,
+                # don't add it
+                if (fromtype, totype) in existingschema.rdefs \
+                        or rschema.rdefs[(fromtype, totype)].infered:
                     continue
                 # check we should actually add the relation definition
                 if not (fromtype in new or totype in new or rschema in new):