hass-core/homeassistant/components/recorder
J. Nick Koston 268425b5e3
Recover from previously failed statistics migrations (#101781)
* Handle statistics columns being unmigrated from previous downgrades

If the user downgraded HA from 2023.3.x to an older version without
restoring the database and they upgrade again with the same database
they will have unmigrated statistics columns since we only migrate them
once.

As its expensive to check, we do not want to check every time
at startup, so we will only do this one more time since the
risk that someone will downgrade to an older version is very
low at this point.

* add guard to sqlite to prevent re-migrate

* test

* move test to insert with old schema

* use helper

* normalize timestamps

* remove

* add check

* add fallback migration

* add fallback migration

* commit

* remove useless logging

* remove useless logging

* do the other columns at the same time

* coverage

* dry

* comment

* Update tests/components/recorder/test_migration_from_schema_32.py
2023-10-22 23:34:43 -04:00
..
auto_repairs Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
history Bump SQLAlchemy to 2.0.21 (#99745) 2023-09-20 16:19:53 +02:00
models Increase max bind vars based on database version (#101464) 2023-10-06 07:59:38 +02:00
system_health
table_managers Increase max bind vars based on database version (#101464) 2023-10-06 07:59:38 +02:00
__init__.py Move event permissions out of the websocket api into auth (#101975) 2023-10-15 23:14:19 +02:00
backup.py
const.py Move event permissions out of the websocket api into auth (#101975) 2023-10-15 23:14:19 +02:00
core.py Increase max bind vars based on database version (#101464) 2023-10-06 07:59:38 +02:00
db_schema.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
entity_registry.py
executor.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
filters.py Remove pylint configs flagged by useless-suppression (#99081) 2023-08-26 17:46:03 +03:00
manifest.json Bump fnv-hash-fast to 0.5.0 (#102271) 2023-10-20 16:49:40 +02:00
migration.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
pool.py
purge.py Increase max bind vars based on database version (#101464) 2023-10-06 07:59:38 +02:00
queries.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
repack.py
services.py
services.yaml
statistics.py Fix compiling missing statistics losing rows (#101616) 2023-10-08 19:43:00 +02:00
strings.json Add deduplicate translations script (#96384) 2023-07-13 11:52:50 -04:00
tasks.py
util.py Increase max bind vars based on database version (#101464) 2023-10-06 07:59:38 +02:00
websocket_api.py