583 self.cmd_add_entity_type(eschema.type) |
583 self.cmd_add_entity_type(eschema.type) |
584 new.add(eschema.type) |
584 new.add(eschema.type) |
585 # check if attributes has been added to existing entities |
585 # check if attributes has been added to existing entities |
586 for rschema in newcubes_schema.relations(): |
586 for rschema in newcubes_schema.relations(): |
587 existingschema = self.repo.schema.rschema(rschema.type) |
587 existingschema = self.repo.schema.rschema(rschema.type) |
588 for (fromtype, totype) in rschema.iter_rdefs(): |
588 for (fromtype, totype) in rschema.rdefs: |
589 if existingschema.has_rdef(fromtype, totype): |
589 if (fromtype, totype) in existingschema.rdefs: |
590 continue |
590 continue |
591 # check we should actually add the relation definition |
591 # check we should actually add the relation definition |
592 if not (fromtype in new or totype in new or rschema in new): |
592 if not (fromtype in new or totype in new or rschema in new): |
593 continue |
593 continue |
594 self.cmd_add_relation_definition(str(fromtype), rschema.type, |
594 self.cmd_add_relation_definition(str(fromtype), rschema.type, |
620 self.cmd_drop_entity_type(eschema.type) |
620 self.cmd_drop_entity_type(eschema.type) |
621 for rschema in fsschema.relations(): |
621 for rschema in fsschema.relations(): |
622 if rschema in removedcubes_schema and rschema in reposchema: |
622 if rschema in removedcubes_schema and rschema in reposchema: |
623 # check if attributes/relations has been added to entities from |
623 # check if attributes/relations has been added to entities from |
624 # other cubes |
624 # other cubes |
625 for fromtype, totype in rschema.iter_rdefs(): |
625 for fromtype, totype in rschema.rdefs: |
626 if not removedcubes_schema[rschema.type].has_rdef(fromtype, totype) and \ |
626 if (fromtype, totype) not in removedcubes_schema[rschema.type].rdefs and \ |
627 reposchema[rschema.type].has_rdef(fromtype, totype): |
627 (fromtype, totype) in reposchema[rschema.type].rdefs: |
628 self.cmd_drop_relation_definition( |
628 self.cmd_drop_relation_definition( |
629 str(fromtype), rschema.type, str(totype)) |
629 str(fromtype), rschema.type, str(totype)) |
630 # execute post-remove files |
630 # execute post-remove files |
631 for pack in reversed(removedcubes): |
631 for pack in reversed(removedcubes): |
632 self.exec_event_script('postremove', self.config.cube_dir(pack)) |
632 self.exec_event_script('postremove', self.config.cube_dir(pack)) |