mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Fix incorrect created and created_ts columns in statistics database schema (#88462)
* Remove default from created statistics schema We were still inserting created times because even though None was passed when creating the object explictly, the default would still be used * adjust column * preserve original pre sql alc 2.0 behavior
This commit is contained in:
parent
68e1aaa0be
commit
9a6bcc2b63
@ -513,10 +513,8 @@ class StatisticsBase:
|
||||
"""Statistics base class."""
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, Identity(), primary_key=True)
|
||||
created: Mapped[datetime] = mapped_column(
|
||||
DATETIME_TYPE, default=dt_util.utcnow
|
||||
) # No longer used
|
||||
created_ts: Mapped[float] = mapped_column(TIMESTAMP_TYPE, default=time.time)
|
||||
created: Mapped[datetime | None] = mapped_column(DATETIME_TYPE) # No longer used
|
||||
created_ts: Mapped[float | None] = mapped_column(TIMESTAMP_TYPE, default=time.time)
|
||||
metadata_id: Mapped[int | None] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey(f"{TABLE_STATISTICS_META}.id", ondelete="CASCADE"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user