Hi everyone,
We are currently addressing a specific scenario in our application. Our system features an overview model that includes a field named ‘PuchaseDate’ (typo). This field is computed using a CMD operation structured as follows:
"operation": "...[/Item/Product/PuchaseValue]....
Our objective is to correct this typo by renaming the ‘PuchaseDate’ tags in the documents xml during the execution of a migration script. However, we are encountering issues as shown by the following logs and exception:
...
INFO [template.server.migrations.BaseMigration][u:] -Running document migration for Item-document
INFO [12.dataservices.search.SearchIndexLoader][u:] - Loading [1] document ids for model [Item-document] took [ 11 ms ]
INFO [12.dataservices.search.SearchIndexLoader][u:] - [1] Documents of model [Item-document] has been updated in [86] ms
INFO [aservices.migration.impl.MigrationRunner][u:] - TASK method [migrationTask] on class [com.mgmtp.a12.template.server.migrations.v102.RenamePurchaseMigration] has been executed in [159ms]..
...
INFO [12.dataservices.search.SearchIndexLoader][u:] - Loading [0] document ids for model [Item-composed] took [ 8 ms ]
...
INFO [12.dataservices.search.SearchIndexLoader][u:] - Loading [1] document ids for model [Item-document] took [ 2 ms ]
INFO [12.dataservices.search.SearchIndexLoader][u:] - [1] Documents of model [Item-document] has been updated in [15] ms
...
INFO [12.dataservices.search.SearchIndexLoader][u:] - Index rebuilt in 208 ms
INFO [12.dataservices.search.SearchInitializer][u:] - Index has been rebuilt with data from DB. Following models have been affected [...,Item-composed,Item-document,...]
...
WARN [.support.internal.DefaultDocumentSupport][u:] - Deserialization of document has failed. Reason: For the entity instance '/Item[1]/PuchaseDate[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
...
Caused by: com.mgmtp.a12.dataservices.utils.internal.DocumentModelException: The validation of document of document model 'Item-document' failed. For the entity instance '/Item[1]/PuchaseDate[1]', the corresponding entity was not found in the corresponding document model. [ERROR,L0,s0,e0],
The exception arises exclusively upon restarting the server for the first time, where the database still holds the documents with the typo in it, which triggers the migration script. During this attempt, the server still appears to build and start normally with the exception, except for the associated overview model, which relies on the migrated document. Unfortunately, the list within this overview model no longer displays any items.
Upon restarting the application for the second time, the previously mentioned exception no longer occurs. Upon inspecting the frontend, it operates seamlessly and accurately displays items in the list.
We assume that after the successful execution of the migration on the first attempt, during the step indicating ‘Index has been rebuilt with data from DB. Following models have been affected […, Item-composed, Item-document, …]’, the index may still retain some outdated values for ‘Item-composed.’ Consequently, when the system attempts to verify ‘Item[1]/PuchaseDate[1]’ (old), it understandably does not exist.
Is it possible that A12-Migrations are currently unsupported when using CDMs? Am i missing something?

