# HG changeset patch # User Sylvain Thénault # Date 1252947557 -7200 # Node ID 2a4bbe3fa4f38a34dc3cff39df90c77c2154cf74 # Parent 1980e9386161e83f346edb72b59167dfb0b85e2c [3.5 migration] avoid removing defined transitions... diff -r 1980e9386161 -r 2a4bbe3fa4f3 misc/migration/bootstrapmigration_repository.py --- a/misc/migration/bootstrapmigration_repository.py Mon Sep 14 18:58:51 2009 +0200 +++ b/misc/migration/bootstrapmigration_repository.py Mon Sep 14 18:59:17 2009 +0200 @@ -35,7 +35,17 @@ add_entity_type('BaseTransition') add_entity_type('WorkflowTransition') add_entity_type('SubWorkflowExitPoint') - drop_relation_definition('State', 'allowed_transition', 'Transition') # should be infered + # drop explicit 'State allowed_transition Transition' since it should be + # infered due to yams inheritance. However we've to disable the schema + # sync hook first to avoid to destroy existing data... + from cubicweb.server.schemahooks import after_del_relation_type + repo.hm.unregister_hook(after_del_relation_type, + 'after_delete_relation', 'relation_type') + try: + drop_relation_definition('State', 'allowed_transition', 'Transition') + finally: + repo.hm.register_hook(after_del_relation_type, + 'after_delete_relation', 'relation_type') schema.rebuild_infered_relations() # need to be explicitly called once everything is in place for et in rql('DISTINCT Any ET,ETN WHERE S state_of ET, ET name ETN',