server/migractions.py
changeset 2476 1294a6bdf3bf
parent 2275 bc0bed0616a3
child 2489 37a747ad6fd4
equal deleted inserted replaced
2475:b6753521129d 2476:1294a6bdf3bf
   475         self.cmd_add_cubes( (cube,), update_database)
   475         self.cmd_add_cubes( (cube,), update_database)
   476 
   476 
   477     def cmd_add_cubes(self, cubes, update_database=True):
   477     def cmd_add_cubes(self, cubes, update_database=True):
   478         """update_database is telling if the database schema should be updated
   478         """update_database is telling if the database schema should be updated
   479         or if only the relevant eproperty should be inserted (for the case where
   479         or if only the relevant eproperty should be inserted (for the case where
   480         a cube has been extracted from an existing application, so the
   480         a cube has been extracted from an existing instance, so the
   481         cube schema is already in there)
   481         cube schema is already in there)
   482         """
   482         """
   483         newcubes = super(ServerMigrationHelper, self).cmd_add_cubes(cubes)
   483         newcubes = super(ServerMigrationHelper, self).cmd_add_cubes(cubes)
   484         if not newcubes:
   484         if not newcubes:
   485             return
   485             return
   640                 if rschema.final or rschema.type in ('owned_by', 'created_by', 'is', 'is_instance_of'):
   640                 if rschema.final or rschema.type in ('owned_by', 'created_by', 'is', 'is_instance_of'):
   641                     continue
   641                     continue
   642                 rtypeadded = rschema.type in applschema
   642                 rtypeadded = rschema.type in applschema
   643                 for targetschema in rschema.objects(etype):
   643                 for targetschema in rschema.objects(etype):
   644                     # ignore relations where the targeted type is not in the
   644                     # ignore relations where the targeted type is not in the
   645                     # current application schema
   645                     # current instance schema
   646                     targettype = targetschema.type
   646                     targettype = targetschema.type
   647                     if not targettype in applschema and targettype != etype:
   647                     if not targettype in applschema and targettype != etype:
   648                         continue
   648                         continue
   649                     if not rtypeadded:
   649                     if not rtypeadded:
   650                         # need to add the relation type and to commit to get it
   650                         # need to add the relation type and to commit to get it
   660                                     ask_confirm=confirm)
   660                                     ask_confirm=confirm)
   661             for rschema in eschema.object_relations():
   661             for rschema in eschema.object_relations():
   662                 rtypeadded = rschema.type in applschema or rschema.type in added
   662                 rtypeadded = rschema.type in applschema or rschema.type in added
   663                 for targetschema in rschema.subjects(etype):
   663                 for targetschema in rschema.subjects(etype):
   664                     # ignore relations where the targeted type is not in the
   664                     # ignore relations where the targeted type is not in the
   665                     # current application schema
   665                     # current instance schema
   666                     targettype = targetschema.type
   666                     targettype = targetschema.type
   667                     # don't check targettype != etype since in this case the
   667                     # don't check targettype != etype since in this case the
   668                     # relation has already been added as a subject relation
   668                     # relation has already been added as a subject relation
   669                     if not targettype in applschema:
   669                     if not targettype in applschema:
   670                         continue
   670                         continue