How to keep history when moving to a new gateway

We need to migrate a series of projects to a new gateway. These projects use a lot of tags where history is enabled. We would like to keep the history data.

To accomplish this task we moved the projects but we kept the history database. The objective is that the tags on the new server uses the same history database of the old ones.
We tried with only one tag just to understand if it works and we discovered that the history is missing.

Looking at history DB we realize that each tag history is related not only to the tag path but also to gateway name. The sqlth_drv table contains both new and old server name. The sqlth_scinfo table has a new record related to new server. In the sqlth_te table all tags are related to the old gateway except for the test tag that is related to new gateway.

sqlth_drv
sqlth_scinfo

We think that could be possible to change the gateway ID (drvid) in sqlth_scinfo table to make all tags related to old server pointing to the new one. But this could seam a potentially harmful solution.

Is there a safe way to keep history when migrating to new gateway?

As someone who has had to deal extensively with the tag history in Ignition.
This is entirely possible. You are on the right track about changing the name to point to the new gateway name. What we ended up doing when moving history was load the data into the new database where the Ignition gateway was. Then changing the name and provider to match what the new project was.

The best thing about this is, if you make a mistake by changing the name. You can always change it back. There is little risk ask long as you take note of how the data was before you make a change.

Hope this helps.
Brandon