Skip to main content
12-Amethyst
September 4, 2023
Solved

Does anyone know what is an "Extension Migrator" for ?

  • September 4, 2023
  • 1 reply
  • 1121 views

Hi,

 

All is in the title.

 

Thanks,

 

 

 

Best answer by VladimirRosu_116627

A migrator gets executed automatically as the first step of the "Import from ThingWorx Storage", essentially being a "pre" type hook in the import process.

Beware that it's only executed in the case of "Import from ThingWorx Storage" - it is not executed automatically during the Extension installation process.

Its role is to allow you to pre-process entities that were created with a previous version of the extension, at import time (eg: execute model changes).

The use-case when this is useful is not encountered extremely frequent and it's documented in this document, page 46.

From what I observed, the Migrator class is a relatively unused part of the ThingWorx Extension SDK.

I personally post-process the entities in an entity's Start event, which, while it's correct that it's being executed at each Start event, from a verification perspective it is really lightweight and I gain ThingWorx's flexibility (it's faster to write that JavaScript and use the snippets available in the service editor than using them in Java).

 

 

1 reply

19-Tanzanite
September 4, 2023

A migrator gets executed automatically as the first step of the "Import from ThingWorx Storage", essentially being a "pre" type hook in the import process.

Beware that it's only executed in the case of "Import from ThingWorx Storage" - it is not executed automatically during the Extension installation process.

Its role is to allow you to pre-process entities that were created with a previous version of the extension, at import time (eg: execute model changes).

The use-case when this is useful is not encountered extremely frequent and it's documented in this document, page 46.

From what I observed, the Migrator class is a relatively unused part of the ThingWorx Extension SDK.

I personally post-process the entities in an entity's Start event, which, while it's correct that it's being executed at each Start event, from a verification perspective it is really lightweight and I gain ThingWorx's flexibility (it's faster to write that JavaScript and use the snippets available in the service editor than using them in Java).

 

 

cbaurand12-AmethystAuthor
12-Amethyst
September 5, 2023

Hi Vladimir,

 

Thx for your comment. It is exactly what we do. But i was wondering if this Migrator was the right way to update entities after change. Seems to not be the case.  😉