mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Adjust warning message when recorder is doing offline migration (#122509)
* Adjust warning message when recorder is doing offline migration * Address review comments
This commit is contained in:
parent
efaf75f2e6
commit
5467685bd8
@ -120,6 +120,13 @@ if TYPE_CHECKING:
|
|||||||
from . import Recorder
|
from . import Recorder
|
||||||
|
|
||||||
LIVE_MIGRATION_MIN_SCHEMA_VERSION = 0
|
LIVE_MIGRATION_MIN_SCHEMA_VERSION = 0
|
||||||
|
|
||||||
|
MIGRATION_NOTE_OFFLINE = (
|
||||||
|
"Note: this may take several hours on large databases and slow machines. "
|
||||||
|
"Home Assistant will not start until the upgrade is completed. Please be patient "
|
||||||
|
"and do not turn off or restart Home Assistant while the upgrade is in progress!"
|
||||||
|
)
|
||||||
|
|
||||||
_EMPTY_ENTITY_ID = "missing.entity_id"
|
_EMPTY_ENTITY_ID = "missing.entity_id"
|
||||||
_EMPTY_EVENT_TYPE = "missing_event_type"
|
_EMPTY_EVENT_TYPE = "missing_event_type"
|
||||||
|
|
||||||
@ -276,9 +283,12 @@ def _migrate_schema(
|
|||||||
|
|
||||||
if current_version < end_version:
|
if current_version < end_version:
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Database is about to upgrade from schema version: %s to: %s",
|
"The database is about to upgrade from schema version %s to %s%s",
|
||||||
current_version,
|
current_version,
|
||||||
end_version,
|
end_version,
|
||||||
|
f". {MIGRATION_NOTE_OFFLINE}"
|
||||||
|
if current_version < LIVE_MIGRATION_MIN_SCHEMA_VERSION
|
||||||
|
else "",
|
||||||
)
|
)
|
||||||
schema_status = dataclass_replace(schema_status, current_version=end_version)
|
schema_status = dataclass_replace(schema_status, current_version=end_version)
|
||||||
|
|
||||||
@ -362,7 +372,7 @@ def _create_index(
|
|||||||
_LOGGER.debug("Creating %s index", index_name)
|
_LOGGER.debug("Creating %s index", index_name)
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Adding index `%s` to table `%s`. Note: this can take several "
|
"Adding index `%s` to table `%s`. Note: this can take several "
|
||||||
"minutes on large databases and slow computers. Please "
|
"minutes on large databases and slow machines. Please "
|
||||||
"be patient!",
|
"be patient!",
|
||||||
index_name,
|
index_name,
|
||||||
table_name,
|
table_name,
|
||||||
@ -411,7 +421,7 @@ def _drop_index(
|
|||||||
"""
|
"""
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Dropping index `%s` from table `%s`. Note: this can take several "
|
"Dropping index `%s` from table `%s`. Note: this can take several "
|
||||||
"minutes on large databases and slow computers. Please "
|
"minutes on large databases and slow machines. Please "
|
||||||
"be patient!",
|
"be patient!",
|
||||||
index_name,
|
index_name,
|
||||||
table_name,
|
table_name,
|
||||||
@ -462,7 +472,7 @@ def _add_columns(
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
(
|
(
|
||||||
"Adding columns %s to table %s. Note: this can take several "
|
"Adding columns %s to table %s. Note: this can take several "
|
||||||
"minutes on large databases and slow computers. Please "
|
"minutes on large databases and slow machines. Please "
|
||||||
"be patient!"
|
"be patient!"
|
||||||
),
|
),
|
||||||
", ".join(column.split(" ")[0] for column in columns_def),
|
", ".join(column.split(" ")[0] for column in columns_def),
|
||||||
@ -524,7 +534,7 @@ def _modify_columns(
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
(
|
(
|
||||||
"Modifying columns %s in table %s. Note: this can take several "
|
"Modifying columns %s in table %s. Note: this can take several "
|
||||||
"minutes on large databases and slow computers. Please "
|
"minutes on large databases and slow machines. Please "
|
||||||
"be patient!"
|
"be patient!"
|
||||||
),
|
),
|
||||||
", ".join(column.split(" ")[0] for column in columns_def),
|
", ".join(column.split(" ")[0] for column in columns_def),
|
||||||
@ -1554,7 +1564,7 @@ def _correct_table_character_set_and_collation(
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"Updating character set and collation of table %s to utf8mb4. "
|
"Updating character set and collation of table %s to utf8mb4. "
|
||||||
"Note: this can take several minutes on large databases and slow "
|
"Note: this can take several minutes on large databases and slow "
|
||||||
"computers. Please be patient!",
|
"machines. Please be patient!",
|
||||||
table,
|
table,
|
||||||
)
|
)
|
||||||
with (
|
with (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user