Merge old MariaDB database

Hi,
I had a corapted database after updating the MariaDB docker, i have a backup of the database ( sql file) , it is possible to merge the old database to current one ?

Thanks in advance

If you have a sql file which can be edited because it is text inside, normally yes, but you have to drop the first lines (drop and create tables/database statements and keep only the lines reloading the data). Pre-requisite: the backup and the existing database ideally must have the same data structure…

Advise: backup also your existing database before executing the merge…

Here is a link to help you:

Thanks, i will try it

Tried to migrate but there is an error say:
Duplicate entry ‘1’ for key ‘PRIMERY’
Do you have any idea?

Maybe when you reloaded the database there are maybe some tables with the same rows…
I found this blog about your problem:

I’ve been looking for a similar solution, have you found one?
The problem I found is that the entity ID’s used for long term statistics do not match the corrupted database ID’s. This is because when Home Assistant recreated the database after it was corrupted all statistic entities got new ID’s.
These ID mismatches will need to be converted through a script.