how to get previous extension version (no object in tree)

shadowmesh
shadowmesh Member Posts: 2
First Comment

Hello,

In case of an extension without tree obect, is there a way to detect an update of extension version? I plan to add a migration function in the callback onload which will performs action in case of extension version incement. Custom object may not be present in the tree so the callback onmigrate is not useful.

Answers

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 240
    First Anniversary First Comment 5 Likes Ansys Employee

    The ExtAPI.ExtensionManager.CurrentExtension will get the current extension context. There are properties for major and minor version that can be accessed.

    I assume there is some sort of data stored in models, otherwise, I don't understand the need to 'migrate' anything to the new version. This is obviously not in custom objects per your description. I would recommend that you store some sort of attribute for the extension major/minor version in this data structure. If you have not done so yet, then the absence of this data will be the flag of the current version.

    Lastly, I am not sure the OnMigrate callback is only for a custom tree object. Is there no app-level OnMigrate callback?

  • shadowmesh
    shadowmesh Member Posts: 2
    First Comment
    edited December 2023

    Indeed there are files inplicitely stored in the system files of the model.
    I tried to user the callback onmigrate at the level, but the log return "No TagInfo for the tagName : 'onmigrate' ". I only found this callback in the simdata-object and workflow level.
    I will go with the attribute in the data structure. Thank you for the advice.