mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix migration of MySQL data when InnoDB is not being used (#72893)
Fixes #72883
This commit is contained in:
parent
219200b340
commit
cd590c79e2
@ -715,14 +715,13 @@ def _apply_update( # noqa: C901
|
|||||||
if engine.dialect.name == SupportedDialect.MYSQL:
|
if engine.dialect.name == SupportedDialect.MYSQL:
|
||||||
# Ensure the row format is dynamic or the index
|
# Ensure the row format is dynamic or the index
|
||||||
# unique will be too large
|
# unique will be too large
|
||||||
with session_scope(session=session_maker()) as session:
|
with contextlib.suppress(SQLAlchemyError):
|
||||||
connection = session.connection()
|
with session_scope(session=session_maker()) as session:
|
||||||
# This is safe to run multiple times and fast since the table is small
|
connection = session.connection()
|
||||||
connection.execute(
|
# This is safe to run multiple times and fast since the table is small
|
||||||
text(
|
connection.execute(
|
||||||
"ALTER TABLE statistics_meta ENGINE=InnoDB, ROW_FORMAT=DYNAMIC"
|
text("ALTER TABLE statistics_meta ROW_FORMAT=DYNAMIC")
|
||||||
)
|
)
|
||||||
)
|
|
||||||
try:
|
try:
|
||||||
_create_index(
|
_create_index(
|
||||||
session_maker, "statistics_meta", "ix_statistics_meta_statistic_id"
|
session_maker, "statistics_meta", "ix_statistics_meta_statistic_id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user