diff --git a/mayan/apps/document_states/migrations/0013_auto_20190423_0810.py b/mayan/apps/document_states/migrations/0013_auto_20190423_0810.py new file mode 100644 index 0000000000..b1bbea5ab5 --- /dev/null +++ b/mayan/apps/document_states/migrations/0013_auto_20190423_0810.py @@ -0,0 +1,33 @@ +from __future__ import unicode_literals + +from django.db import migrations + + + +def operation_add_full_path(apps, schema_editor): + WorkflowStateAction = apps.get_model('document_states', 'WorkflowStateAction') + + for workflow_state_action in WorkflowStateAction.objects.using(schema_editor.connection.alias).all(): + workflow_state_action.action_path = 'mayan.apps.{}'.format(workflow_state_action.action_path) + workflow_state_action.save() + + +def operation_remove_full_path(apps, schema_editor): + WorkflowStateAction = apps.get_model('document_states', 'WorkflowStateAction') + + for workflow_state_action in WorkflowStateAction.objects.using(schema_editor.connection.alias).all(): + workflow_state_action.action_path = workflow_state_action.action_path.replace('mayan.apps.','') + workflow_state_action.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('document_states', '0012_auto_20180823_2353'), + ] + + operations = [ + migrations.RunPython( + operation_add_full_path, reverse_code=operation_remove_full_path + ) + ]