33 if applcubicwebversion < (3, 5, 0) and cubicwebversion >= (3, 5, 0): |
33 if applcubicwebversion < (3, 5, 0) and cubicwebversion >= (3, 5, 0): |
34 add_entity_type('Workflow') |
34 add_entity_type('Workflow') |
35 add_entity_type('BaseTransition') |
35 add_entity_type('BaseTransition') |
36 add_entity_type('WorkflowTransition') |
36 add_entity_type('WorkflowTransition') |
37 add_entity_type('SubWorkflowExitPoint') |
37 add_entity_type('SubWorkflowExitPoint') |
38 drop_relation_definition('State', 'allowed_transition', 'Transition') # should be infered |
38 # drop explicit 'State allowed_transition Transition' since it should be |
|
39 # infered due to yams inheritance. However we've to disable the schema |
|
40 # sync hook first to avoid to destroy existing data... |
|
41 from cubicweb.server.schemahooks import after_del_relation_type |
|
42 repo.hm.unregister_hook(after_del_relation_type, |
|
43 'after_delete_relation', 'relation_type') |
|
44 try: |
|
45 drop_relation_definition('State', 'allowed_transition', 'Transition') |
|
46 finally: |
|
47 repo.hm.register_hook(after_del_relation_type, |
|
48 'after_delete_relation', 'relation_type') |
39 schema.rebuild_infered_relations() # need to be explicitly called once everything is in place |
49 schema.rebuild_infered_relations() # need to be explicitly called once everything is in place |
40 |
50 |
41 for et in rql('DISTINCT Any ET,ETN WHERE S state_of ET, ET name ETN', |
51 for et in rql('DISTINCT Any ET,ETN WHERE S state_of ET, ET name ETN', |
42 ask_confirm=False).entities(): |
52 ask_confirm=False).entities(): |
43 wf = add_workflow(u'default %s workflow' % et.name, et.name, |
53 wf = add_workflow(u'default %s workflow' % et.name, et.name, |