Tweak DB migration to schema version 21 (#56767)
This commit is contained in:
parent
be34a2ddea
commit
52e9f76f94
1 changed files with 3 additions and 1 deletions
|
@ -522,9 +522,11 @@ def _apply_update(instance, session, new_version, old_version): # noqa: C901
|
||||||
)
|
)
|
||||||
with contextlib.suppress(SQLAlchemyError):
|
with contextlib.suppress(SQLAlchemyError):
|
||||||
connection.execute(
|
connection.execute(
|
||||||
|
# Using LOCK=EXCLUSIVE to prevent the database from corrupting
|
||||||
|
# https://github.com/home-assistant/core/issues/56104
|
||||||
text(
|
text(
|
||||||
f"ALTER TABLE {table} CONVERT TO "
|
f"ALTER TABLE {table} CONVERT TO "
|
||||||
"CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
|
"CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci LOCK=EXCLUSIVE"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif new_version == 22:
|
elif new_version == 22:
|
||||||
|
|
Loading…
Add table
Reference in a new issue