core/tests/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
table_managers
__init__.py
common.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
db_schema_0.py
db_schema_16.py
db_schema_18.py
db_schema_22.py
db_schema_23.py
db_schema_23_with_newer_columns.py
db_schema_25.py
db_schema_28.py
db_schema_30.py
db_schema_32.py
test_backup.py
test_entity_registry.py
test_filters.py
test_filters_with_entityfilter.py
test_filters_with_entityfilter_schema_37.py
test_history.py
test_history_db_schema_30.py
test_history_db_schema_32.py
test_init.py
test_migrate.py
test_migration_from_schema_32.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
test_models.py
test_models_legacy.py
test_pool.py
test_purge.py Reduce number of test states in big purge test to fix CI (#102401) 2023-10-20 08:09:59 -10:00
test_purge_v32_schema.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
test_statistics.py Fix compiling missing statistics losing rows (#101616) 2023-10-08 19:43:00 +02:00
test_statistics_v23_migration.py
test_system_health.py
test_util.py
test_v32_migration.py
test_websocket_api.py Fix compiling missing statistics losing rows (#101616) 2023-10-08 19:43:00 +02:00