Hello,
Background:
I have a lot of Devices and I want to keep certain naming convention to have it little bit structured. In such spirit I started renaming Devices I added few weeks back. I realized that while renaming Devices, Entity IDs can be renamed in one click as well (what I cool think I thought myself).
However once Entity IDs changed all history was reset. I see in DB that data are in but are not linked to renamed Entity ID.
My thinking was to create a SQL script that would fix this. Now I am struggling to understand the data model.
Questions:
-
Am I missing something when I assume that Entity ID change shall not disconnect past data? Is there a reason why this is implemented that when Entity ID is renamed past data are not re-linked to the new Entity ID?
-
My thinking was that all the old data and the new data related to the same Entity ID can be identified via same Device (when renaming Device in UI it know what Entity IDs are related to it so there must be somewhere the relationship recorded). What table/entries in DB are identifying the Device and related Entity IDs?
-
If my assumption from 2. is wrong, is there a way in database to easily identify data related to the same Entity that Entity ID was renamed few times? My thinking that after such identification, few simple DB updates shall put all data in line with current Entity ID.
Goal:
In the end, I would like to create script or integration that would solve the issue of renaming Devices/Entity IDs is causing loss of history.
Thank you!