# HG changeset patch # User Sylvain Thénault # Date 1449679457 -3600 # Node ID 37c5c9b3b3bfc44befa00a832e962e6c04080f47 # Parent dc9de651c328a410a6a84e19aa3bcb062868d132 [migration] handle the case where new final entity type is not yet in the schema This may occur on new cube addition. Related to #7569998. diff -r dc9de651c328 -r 37c5c9b3b3bf server/migractions.py --- 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()