Custom entity_id's suddenly reset

I had setup custom entity_id’s for my Z-Wave and IKEA Tradfri devices and it was working quite well. However yesterday they all suddenly reset to their default names. Since I have a lot of the same devices, it is quite hard to tell them all apart now and I have to figure it out again.

Earlier that evening I setup MariaDB instead of SQLite and also changed the batteries on some of my Z-Wave nodes if that makes a difference. Late last night I did a reboot, since HASS seemed unresponsive. After the reboot, the entity_id’s and custom names were suddnely gone.

So my true question is, how is this possible? And how can I avoid it in the future? ie. what is the correct way to customize these entities?

I just saw that my

.storage/core.config_entries
.storage/core.device_registry

Are overwritten when I restart HASS. I have a Git backup of this file, but it seems that the old devices aren’t found… How is this possible?

Appearently it was because I made the switch to MariaDB… Can be solved / closed.