Adding new Workflow step break existing Books workflow (editoria-vanilla)
Steps to reproduce
- add new workflow step to config file
config/modules/book-builder.js
as a first step - reseed Application Parameters with
scripts/seedApplicationParameter.js
- open any existing Book
Result: exception thrown in client's browser
Proposed solution
We need to update existing Books with new Workflow Steps at database level.
Assuming we have workflow consisting of steps [A, B, C], where B is a current step, so step A is completed and steps B and C are not.
If we add new workflow step Z on Application level, then :
- if Z is before current step, for example[ A, Z, B, C], Z considered completed.
- if Z is after current step, for example [ A, B, Z, C], Z considered not completed.
If we remove one or more steps from Workflow, they are just being removed from existing Book's Workflow without any side effects.
This migration can be done as part of seeding process of Application Parameters (seedApplicationParameter.js).