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