mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Set unique on StatesMeta and EventTypes database tables (#89971)
Set unique on StatesMeta and EventTypes These should have been marked unique originally to prevent collision bugs from going unnoticed. These have not been to beta yet so this is not a breaking change
This commit is contained in:
parent
817ba97227
commit
bf63e6cbd4
@ -350,7 +350,7 @@ class EventTypes(Base):
|
||||
__tablename__ = TABLE_EVENT_TYPES
|
||||
event_type_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True)
|
||||
event_type: Mapped[str | None] = mapped_column(
|
||||
String(MAX_LENGTH_EVENT_EVENT_TYPE), index=True
|
||||
String(MAX_LENGTH_EVENT_EVENT_TYPE), index=True, unique=True
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
@ -600,7 +600,7 @@ class StatesMeta(Base):
|
||||
__tablename__ = TABLE_STATES_META
|
||||
metadata_id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True)
|
||||
entity_id: Mapped[str | None] = mapped_column(
|
||||
String(MAX_LENGTH_STATE_ENTITY_ID), index=True
|
||||
String(MAX_LENGTH_STATE_ENTITY_ID), index=True, unique=True
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
Loading…
x
Reference in New Issue
Block a user