The task MigrateBlockToIntermediateParentTask doesn't preserve the order of nodes. Running the task can actually reorder the nodes to an incorrect state.
- Using a version of Magnolia with Content editor 1.x (for example 6.2.10) startup and do a fresh install.
- Export one of the stories from the demo --> stories.stories-demo.lost-and-found-in-swiss-alps-6.2.10.yaml
- Shut down and copy the repository from the 6.2.10 instance to a current release like 6.2.24.
- Startup and perform the upgrade.
- Login and use the groovy script provided in documentation to migrate the data.
- Export the same story as in step 2 and compare the order of the blocks --> stories.stories-demo.lost-and-found-in-swiss-alps-6.2.24.yaml
The blocks should be in the same order after the migration of data.
The blocks have been reordered as shown in the screenshots.
The problem is the task is not using NodeUtil#moveNodeAfter(). You have to iterate over the old list and keep track of the last node which was moved so that the nodes can be moved in the same order.
You can fix the order as long as you have an older system to retrieve the order from.
Execute scripts.getPreviousStoryOrder.xml to get a JSON object from the old system which can be fed into scripts.repairStoryBlockOrder.xml to be run on the new system. See comment below for more details.