mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Create tables with a charset that can hold all expected data under mysql (#43732)
By default these tables are created with utf8 which can only hold 3 bytes. This meant that all emjoi would trigger a MySQLdb._exceptions.OperationalError because they are 4 bytes. This will only fix the issue for users who recreate their tables.
This commit is contained in:
parent
dd513147a5
commit
1162d9a752
@ -42,6 +42,10 @@ ALL_TABLES = [TABLE_STATES, TABLE_EVENTS, TABLE_RECORDER_RUNS, TABLE_SCHEMA_CHAN
|
|||||||
class Events(Base): # type: ignore
|
class Events(Base): # type: ignore
|
||||||
"""Event history data."""
|
"""Event history data."""
|
||||||
|
|
||||||
|
__table_args__ = {
|
||||||
|
"mysql_default_charset": "utf8mb4",
|
||||||
|
"mysql_collate": "utf8mb4_unicode_ci",
|
||||||
|
}
|
||||||
__tablename__ = TABLE_EVENTS
|
__tablename__ = TABLE_EVENTS
|
||||||
event_id = Column(Integer, primary_key=True)
|
event_id = Column(Integer, primary_key=True)
|
||||||
event_type = Column(String(32))
|
event_type = Column(String(32))
|
||||||
@ -96,6 +100,10 @@ class Events(Base): # type: ignore
|
|||||||
class States(Base): # type: ignore
|
class States(Base): # type: ignore
|
||||||
"""State change history."""
|
"""State change history."""
|
||||||
|
|
||||||
|
__table_args__ = {
|
||||||
|
"mysql_default_charset": "utf8mb4",
|
||||||
|
"mysql_collate": "utf8mb4_unicode_ci",
|
||||||
|
}
|
||||||
__tablename__ = TABLE_STATES
|
__tablename__ = TABLE_STATES
|
||||||
state_id = Column(Integer, primary_key=True)
|
state_id = Column(Integer, primary_key=True)
|
||||||
domain = Column(String(64))
|
domain = Column(String(64))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user