Backup Restore Deleted my database

I recently did a full system restore (starting with a new SD card) everything seems to be working just like I left it, but I noticed that all my long term statistics are gone. I checked my old database file (in the backup) and its 200MB long, and the new db is like 15 MB. Is the restore supposed to pick up my database just as I left it? I am using the default SQLLite database on a Rpi4.

I never cared for the database since I wiped it every 24hrs, but with long term statistics, they become much more important. is there a way to restore this information?

No

You restored so should be like it was when saved in the past

That’s because if you use the default recorder database (SQLite) this got corrupted during every backup process.

It was fixed (or at least merged) in December 2021 with https://github.com/home-assistant/core/pull/61161 / https://github.com/home-assistant/core/pull/60874.

Don’t know when and which way it was shipped (probably Supervisor? Or Home Assistant Core directly?) but if you nowadays create and restore a backup, the SQLite recorder database should work without issues.

Update:
See details @ Fix corrupted / malformed SQLite database (home-assistant_v2.db) - #23 by e-raser.

1 Like