Frequent sql issues and db corrupt, database disk image is malformed

Hello team,
first message here for me.
I’m a newbie and I’ve installed HA recently.
It’s: Home Assistant 2023.2.2
Supervisor 2023.01.1
Operating System 9.5
Frontend 20230202.0 - latest
on a Raspberry PI 4.

I’ve enabled some dashboard, the primary one that I use is the Energy one that read the data from the Tesla Powerwall 2 battery.

My problem is that I lose the data from time to time. If I look at the file I see this… it looks like that at 4.12 am the db get corrupted for I don’t know which reason.

If I read the logs I see this: Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

sqlite3.DatabaseError: database disk image is malformed

Honestly I’ve no idea why the db get corrupted.
Is there anyone that can help?

I’ve searched in the forum and I see I’m not the only one with this problem of loosing data in the energy dashboard.

Thanks in advance.

POST: I tried to switch to MariaDB from SQLite… let’s see if this works and help.