We should also migrate existing Thing Descriptions in the database to the new default context so that they don't have to be modified at runtime every time they are read.
I had written some code to do this, but it turned out to be redundant. Those Thing Descriptions already get updated on startup as a side effect of the updateFromDescription() method being called for every existing device when handling deviceAdded messages from adapters. I don't think this is necessarily desirable, so I plan to revisit this in a follow-up and figure out what's going on there.
https://github.com/WebThingsIO/gateway/pull/3034 added logic to standardise the
@context
member used in Thing Descriptions.We should also migrate existing Thing Descriptions in the database to the new default context so that they don't have to be modified at runtime every time they are read.
I had written some code to do this, but it turned out to be redundant. Those Thing Descriptions already get updated on startup as a side effect of the
updateFromDescription()
method being called for every existing device when handlingdeviceAdded
messages from adapters. I don't think this is necessarily desirable, so I plan to revisit this in a follow-up and figure out what's going on there.See https://github.com/WebThingsIO/virtual-things-adapter/issues/66 for an example of an add-on which calls
handleDeviceAdded()
on startup.