Tags changing history storage provider after gateway restart

The setup is multiple Edge gateways sending tags to a main gateway via MQTT.
We had some tags that needed to migrate to a new history storage provider on the main geteway. This was achieved via scripting because of the large number of tags and was done successfully. We modified the vision windows (like charts and data export buttons) to work with the new database. But after a gateway restart, all the tags have gone back to the old storage provider. I have no idea why this happened or how we can prevent this from happening again.
Also what will happen if the main gateway goes offline? Will it revert the tags to the old history provider every time it goes back online?