From cd590c79e2a67f953a3631d783aa466915fc9ad2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 2 Jun 2022 02:01:06 -1000 Subject: [PATCH] Fix migration of MySQL data when InnoDB is not being used (#72893) Fixes #72883 --- homeassistant/components/recorder/migration.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index bc636d34b10..cc5af684566 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -715,14 +715,13 @@ def _apply_update( # noqa: C901 if engine.dialect.name == SupportedDialect.MYSQL: # Ensure the row format is dynamic or the index # unique will be too large - with session_scope(session=session_maker()) as session: - connection = session.connection() - # This is safe to run multiple times and fast since the table is small - connection.execute( - text( - "ALTER TABLE statistics_meta ENGINE=InnoDB, ROW_FORMAT=DYNAMIC" + with contextlib.suppress(SQLAlchemyError): + with session_scope(session=session_maker()) as session: + connection = session.connection() + # This is safe to run multiple times and fast since the table is small + connection.execute( + text("ALTER TABLE statistics_meta ROW_FORMAT=DYNAMIC") ) - ) try: _create_index( session_maker, "statistics_meta", "ix_statistics_meta_statistic_id"