How to handle template upgrades and data migration between versions
Upgrade mapping facilitates users upgrading from older to newer versions of templates without losing data. If a widget is removed or changes format, this section tells the upgrade mechanism what to do with it.
Important: Upgrade mappings are only relevant for inputs (input widgets, lookup widgets, or inputs/lookups within table columns) - it has nothing to do with equation widgets. They are only about how to transfer a userโs inputs from an older version of a template to its newer version.
If no upgrade mappings were set, the โCalculation Upgradesโ mechanism would ONLY do a 1:1 copy of:
[referenceId in old template version] โ [referenceId in new template version]
This means that ALL other data not matching referenceIds will be lost. If you want anything to happen on the upgrade other than a 1:1 copy of referenceIds, then you need to write an upgrade mapping for it.
Fun Quirk: Upgrade mappings are run in the order that they are entered in the JSON code. If you set a new value of a widget with a mapping, and then use that widgetโs value in an upgrade mapping, it will use the new value instead of the old one. This is particularly important when checking if a widget exists.
โIgnoreโ only affects equation mappings - it has no effect on sharedTable mappings. Also, if youโve included a mapping from a deprecated id to a new one, you donโt need to repeat it in the ignore section.