WTH: Migrate history when enabling Recorder

When enabling the Recorder integration, there’s no option to migrate your history to it. WTH? If using the MariaDB addon is the “recommended” way as opposed to the default “SQLite” one, then migrating the history should be supported too.

Sure there are instructions to do this (e.g. Migrating home assistant database from sqlite to mariadb - #84 by le_top) but they’re not exactly simple to follow. And this must affect basically every user.

It isn’t; the default SQLite database is the recommendation according to the docs:

There are community-documented methods of migration, if that is still helpful. Here’s one I could find, though there may be more:

Whether migration can or should be built-in is something I can’t answer, and I do know some people claim better performance (for things like viewing history, at least) with another database engine. But, at least, I don’t see any official recommendation not to use the default. :slight_smile:

I think, one of the major topics that should be considered in the future is the focus on the Hardware.
I really understand why HA was intended to be able to run on a Pi… For beginners, it might be a nice way to start their way into the world of HomeAssistant - but it also has some (in my eyes) major disadvantages.

it usually requires a local “in memory” database - such as SQLite - which will have an impact on the performance… and of course, the backup strategy… we already have several topics in the forum complaining about missing backups of the energy dashboard - which is (again in my eyes) a consequence of the used Database.

Running a dedicated Database, such as MariaDB - maybe even on a different host will solve all these issues, since your HA Backups are nothing more than backups of the core software and your configuration.
Backups of your DATA will be done on a different level - and you wont loose energy stats or whatever.

I totaly agree:
You ARE able to change the Database - by using the recorder option in the config.
And then, it should Migrate the energy dashboard data and everything else.

There is already WTH topic for easy migration:

please vote there…

3 Likes

@sisri Ah! Thanks. Not sure why I didn’t find that.

@RMoRobert , you’re quite right that I’ve exaggerated the situation. But as I see it, there are two “recommended” courses of action:

  • For most people, the default sqlite database is “recommended”. This is the case in the official docs, since it works well enough for everyone, regardless of technical capability and hardware.
  • If you are able to (e.g. your hardware supports it), then it’s “recommended” to migrated the database to MariaDB, MySQL or similar. This is the case is most community guides, since it the technically superior option, e.g. performance, robustness, functionality, etc.

But I think more and more people are migrating to hardware that could support a dedicated database, i.e. anything with an SSD, including Home Assistant Blue and Yellow.

One of the main issues is that the community migration guides will be instantly out-of-date if the way HA uses the database changes, making for more headaches for more people. There should be an officially supported method to do this migration.