server/migractions.py
changeset 11001 37c5c9b3b3bf
parent 10928 0aa9da35db30
child 11002 2973522a1924
equal deleted inserted replaced
11000:dc9de651c328 11001:37c5c9b3b3bf
    45 from six import PY2, text_type
    45 from six import PY2, text_type
    46 
    46 
    47 from logilab.common.deprecation import deprecated
    47 from logilab.common.deprecation import deprecated
    48 from logilab.common.decorators import cached, clear_cache
    48 from logilab.common.decorators import cached, clear_cache
    49 
    49 
       
    50 from yams.buildobjs import EntityType
    50 from yams.constraints import SizeConstraint
    51 from yams.constraints import SizeConstraint
    51 from yams.schema import RelationDefinitionSchema
    52 from yams.schema import RelationDefinitionSchema
    52 
    53 
    53 from cubicweb import CW_SOFTWARE_ROOT, AuthenticationError, ExecutionError
    54 from cubicweb import CW_SOFTWARE_ROOT, AuthenticationError, ExecutionError
    54 from cubicweb.predicates import is_instance
    55 from cubicweb.predicates import is_instance
   788         confirm = self.verbosity >= 2
   789         confirm = self.verbosity >= 2
   789         groupmap = self.group_mapping()
   790         groupmap = self.group_mapping()
   790         cstrtypemap = self.cstrtype_mapping()
   791         cstrtypemap = self.cstrtype_mapping()
   791         # register the entity into CWEType
   792         # register the entity into CWEType
   792         execute = self.cnx.execute
   793         execute = self.cnx.execute
       
   794         if eschema.final and eschema not in instschema:
       
   795             # final types are expected to be in the living schema by default, but they are not if
       
   796             # the type is defined in a cube that is being added
       
   797             edef = EntityType(eschema.type, __permissions__=eschema.permissions)
       
   798             instschema.add_entity_type(edef)
   793         ss.execschemarql(execute, eschema, ss.eschema2rql(eschema, groupmap))
   799         ss.execschemarql(execute, eschema, ss.eschema2rql(eschema, groupmap))
   794         # add specializes relation if needed
   800         # add specializes relation if needed
   795         specialized = eschema.specializes()
   801         specialized = eschema.specializes()
   796         if specialized:
   802         if specialized:
   797             try:
   803             try: