mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Ensure the statistics_meta table is using the dynamic row format (#72784)
This commit is contained in:
parent
a8da0eedd3
commit
856e1144c9
@ -712,6 +712,17 @@ def _apply_update( # noqa: C901
|
|||||||
elif new_version == 29:
|
elif new_version == 29:
|
||||||
# Recreate statistics_meta index to block duplicated statistic_id
|
# Recreate statistics_meta index to block duplicated statistic_id
|
||||||
_drop_index(session_maker, "statistics_meta", "ix_statistics_meta_statistic_id")
|
_drop_index(session_maker, "statistics_meta", "ix_statistics_meta_statistic_id")
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
)
|
||||||
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