Upgrading key-value data records
This is a continuation of the upgrade implementation tutorial.
There is payment extension which uses key-value data storage.
Please use the following reference articles to find more details on extensions infrastructure:
If you have a key-value data records and you need to provide upgrades for the them, you can follow the steps below to get to know how it is done.
Step 1: Implement upgrade class
Create upgrade class in 'new' version folder
Since we don't need to implement any 'old' and 'new' models in 'v1.0.0' folders, we should start with 'v1.0.1' only ('v1.0.0' is not needed):

Create a new class in your 'Upgrades/v1.0.1' folder:

Fix namespaces
Don't forget to change messy v1._0._1 namespace name generated by the Visual Studio
to more readable v1_0_1:
Inherit from KeyValueDataUpgrade
Now inherit your newly added class from Sana.Extensions.Upgrades.KeyValueDataUpgrade
abstract class:

Implement abstract members
Because the base KeyValueDataUpgrade class is abstract, you now need to implement it's
abstract members.
Implement UpgradeTo property
This is a property which tells Sana Commerce Cloud to which version this upgrade class upgrades the data to.
So in our case we're creating upgrade to version 1.0.1, so our UpgradeTo should indicate
exactly that:

Implement KeyValueDataUpgrade method
This is the actual upgrade implementation. Implement what you need to upgrade in your data record from previous version to current (from 1.0.0 to 1.0.1).
You can read more about what exactly you can do in the upgrade with examples in a separate article.
Note that unlike in the previous upgrade tutorials, there is no 'old' and 'new'
model involved. There is only one parameter in the KeyValueDataUpgrade method,
which is UpgradableKeyValueDataModel and you can change its Data property:
dataRecord.Data
You can also access the Key of the data record in case you need it, but you cannot
modify its value - the property is read-only:
dataRecord.Key
In our example we will simply append some dummy text to our data:

Step 2: Test it
When your upgrade has been implemented, you can build your extension add-on and update it in Sana Admin (Apps > Add-ons > click Update on your add-on). After the newest version has been installed, execute payment in Sana Commence Cloud and view values via debugger:
Before the upgrade, version 1.0.0:
We have saved '94665317961988' in key-value data storage.
After the upgrade, version 1.0.1:

We have got upgraded value from key-value data storage '94665317961988 - upgraded in version 1.0.1'
Next version
When you implement the next version of your extension, in our example it will be version 1.0.2, you simply add a new 'Upgrades/v1.0.2' folder and continue from Step 1: Implement upgrade class:

Conclusion
That's it, the upgrade of data records is complete.