hass-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 Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
table_managers Rename recorder run_history to table_managers.recorder_runs_manager (#90070) 2023-03-21 18:38:33 -10:00
__init__.py Use python defaults for comparing State, LazyState, and Event objects (#86856) 2023-01-29 13:31:43 -05:00
common.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
db_schema_0.py Avoid use of datetime.utc* methods deprecated in Python 3.12 (#93684) 2023-08-24 16:38:22 +02:00
db_schema_16.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_18.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_22.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_23.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_23_with_newer_columns.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_25.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_28.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_30.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
db_schema_32.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_backup.py Add type hints to integration tests (recorder) (#88313) 2023-02-17 18:50:09 +01:00
test_entity_registry.py Require a list of entity ids when fetching history (#90992) 2023-04-08 16:14:44 -10:00
test_filters.py Ensure filters are generated inside the lambda locks (#90418) 2023-03-28 20:50:10 +02:00
test_filters_with_entityfilter.py Deduplicate entity_id in the states table (#89557) 2023-03-12 10:01:58 -10:00
test_filters_with_entityfilter_schema_37.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_history.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_history_db_schema_30.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_history_db_schema_32.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_init.py Remove support for excluding attributes in recorder platforms (#100679) 2023-09-24 14:45:06 +02:00
test_migrate.py Dynamically size recorder max backlog based on available memory (#90894) 2023-04-18 12:35:49 +02:00
test_migration_from_schema_32.py Recover from previously failed statistics migrations (#101781) 2023-10-22 23:34:43 -04:00
test_models.py Remove support for excluding attributes in recorder platforms (#100679) 2023-09-24 14:45:06 +02:00
test_models_legacy.py Avoid multiple round trips to the database for history API calls (#91193) 2023-04-11 22:38:23 -04:00
test_pool.py Fix recorder DeprecationWarnings (#97738) 2023-08-04 11:32:51 +02:00
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 Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_system_health.py Rename recorder run_history to table_managers.recorder_runs_manager (#90070) 2023-03-21 18:38:33 -10:00
test_util.py Python 3.10 support cleanups (#98640) 2023-08-21 19:14:07 +02:00
test_v32_migration.py Remove unnnecessary pylint configs from components [m-r]* (#98924) 2023-08-24 00:56:50 +02:00
test_websocket_api.py Fix compiling missing statistics losing rows (#101616) 2023-10-08 19:43:00 +02:00