Minor improvements of recorder typing (#80165)
* Minor improvements of recorder typing * Only allow specifying statistic_ids as lists
This commit is contained in:
parent
83557ef762
commit
577f7904b5
4 changed files with 28 additions and 30 deletions
|
@ -1,9 +1,11 @@
|
|||
"""Schema migration helpers."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Iterable
|
||||
import contextlib
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, cast
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
import sqlalchemy
|
||||
from sqlalchemy import ForeignKeyConstraint, MetaData, Table, func, text
|
||||
|
@ -40,6 +42,9 @@ from .statistics import (
|
|||
)
|
||||
from .util import session_scope
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import Recorder
|
||||
|
||||
LIVE_MIGRATION_MIN_SCHEMA_VERSION = 0
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -86,7 +91,7 @@ def live_migration(current_version: int) -> bool:
|
|||
|
||||
|
||||
def migrate_schema(
|
||||
instance: Any,
|
||||
instance: Recorder,
|
||||
hass: HomeAssistant,
|
||||
engine: Engine,
|
||||
session_maker: Callable[[], Session],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue