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
1 changed files with 8 additions and 0 deletions
|
@ -42,6 +42,10 @@ ALL_TABLES = [TABLE_STATES, TABLE_EVENTS, TABLE_RECORDER_RUNS, TABLE_SCHEMA_CHAN
|
|||
class Events(Base): # type: ignore
|
||||
"""Event history data."""
|
||||
|
||||
__table_args__ = {
|
||||
"mysql_default_charset": "utf8mb4",
|
||||
"mysql_collate": "utf8mb4_unicode_ci",
|
||||
}
|
||||
__tablename__ = TABLE_EVENTS
|
||||
event_id = Column(Integer, primary_key=True)
|
||||
event_type = Column(String(32))
|
||||
|
@ -96,6 +100,10 @@ class Events(Base): # type: ignore
|
|||
class States(Base): # type: ignore
|
||||
"""State change history."""
|
||||
|
||||
__table_args__ = {
|
||||
"mysql_default_charset": "utf8mb4",
|
||||
"mysql_collate": "utf8mb4_unicode_ci",
|
||||
}
|
||||
__tablename__ = TABLE_STATES
|
||||
state_id = Column(Integer, primary_key=True)
|
||||
domain = Column(String(64))
|
||||
|
|
Loading…
Add table
Reference in a new issue