server/migractions.py
changeset 11001 37c5c9b3b3bf
parent 10928 0aa9da35db30
child 11002 2973522a1924
--- a/server/migractions.py	Wed Dec 09 17:44:16 2015 +0100
+++ b/server/migractions.py	Wed Dec 09 17:44:17 2015 +0100
@@ -47,6 +47,7 @@
 from logilab.common.deprecation import deprecated
 from logilab.common.decorators import cached, clear_cache
 
+from yams.buildobjs import EntityType
 from yams.constraints import SizeConstraint
 from yams.schema import RelationDefinitionSchema
 
@@ -790,6 +791,11 @@
         cstrtypemap = self.cstrtype_mapping()
         # register the entity into CWEType
         execute = self.cnx.execute
+        if eschema.final and eschema not in instschema:
+            # final types are expected to be in the living schema by default, but they are not if
+            # the type is defined in a cube that is being added
+            edef = EntityType(eschema.type, __permissions__=eschema.permissions)
+            instschema.add_entity_type(edef)
         ss.execschemarql(execute, eschema, ss.eschema2rql(eschema, groupmap))
         # add specializes relation if needed
         specialized = eschema.specializes()