1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Break out statistics repairs into a auto_repairs modules (#90068)

* Break out statistics schema repairs into a repairs module

A future PR will add repairs for events, states, etc

* reorg

* reorg

* reorg

* reorg

* fixes

* fix patch targets

* name space rename
This commit is contained in:
J. Nick Koston
2023-03-21 15:08:06 -10:00
committed by GitHub
parent 086bcfb2fc
commit ddcaa9d372
12 changed files with 1157 additions and 1045 deletions

View File

@@ -1282,13 +1282,16 @@ def hass_recorder(
# pylint: disable-next=import-outside-toplevel
from homeassistant.components import recorder
# pylint: disable-next=import-outside-toplevel
from homeassistant.components.recorder.auto_repairs.statistics import schema
original_tz = dt_util.DEFAULT_TIME_ZONE
hass = get_test_home_assistant()
nightly = recorder.Recorder.async_nightly_tasks if enable_nightly_purge else None
stats = recorder.Recorder.async_periodic_statistics if enable_statistics else None
stats_validate = (
recorder.statistics.validate_db_schema
schema.validate_db_schema
if enable_statistics_table_validation
else itertools.repeat(set())
)
@@ -1397,13 +1400,16 @@ async def async_setup_recorder_instance(
# pylint: disable-next=import-outside-toplevel
from homeassistant.components import recorder
# pylint: disable-next=import-outside-toplevel
from homeassistant.components.recorder.auto_repairs.statistics import schema
# pylint: disable-next=import-outside-toplevel
from .components.recorder.common import async_recorder_block_till_done
nightly = recorder.Recorder.async_nightly_tasks if enable_nightly_purge else None
stats = recorder.Recorder.async_periodic_statistics if enable_statistics else None
stats_validate = (
recorder.statistics.validate_db_schema
schema.validate_db_schema
if enable_statistics_table_validation
else itertools.repeat(set())
)