"""SQLAlchemy model for the 'events' table in the Home Assistant PostgreSQL database.""" from sqlalchemy import ( Column, BigInteger, CHAR, SmallInteger, TIMESTAMP, Float, LargeBinary, ForeignKey, ) from .base import Base class Events(Base): """SQLAlchemy model for the 'events' table.""" __tablename__ = "events" __table_args__ = {"schema": "public"} event_id = Column(BigInteger, primary_key=True, autoincrement=True) event_type = Column(CHAR(1), nullable=True) event_data = Column(CHAR(1), nullable=True) origin = Column(CHAR(1), nullable=True) origin_idx = Column(SmallInteger, nullable=True) time_fired = Column(TIMESTAMP(timezone=True), nullable=True) time_fired_ts = Column(Float, nullable=True) context_id = Column(CHAR(1), nullable=True) context_user_id = Column(CHAR(1), nullable=True) context_parent_id = Column(CHAR(1), nullable=True) data_id = Column(BigInteger, ForeignKey("public.event_data.data_id"), nullable=True) context_id_bin = Column(LargeBinary, nullable=True) context_user_id_bin = Column(LargeBinary, nullable=True) context_parent_id_bin = Column(LargeBinary, nullable=True) event_type_id = Column( BigInteger, ForeignKey("public.event_types.event_type_id"), nullable=True )