"""WebSocket replay buffer (F-014): every broadcast event gets a seq id the clients resume from. Written and read with raw SQL in services/ws_bus.py (hot path, no ORM). The model exists so the table is part of the Alembic-managed schema. - sqlite_autoincrement: ids must never be reused after old rows are pruned, or a client's cursor could skip events. - created_at is an ISO string with offset (v1 audit, APPS_PLATFORM ยง7.4). >>> Step 1.1 converts it to the UTC datetime type. """ from sqlalchemy import Column, Integer, String, Text from database import Base class SyncEvent(Base): __tablename__ = "sync_events" __table_args__ = {"sqlite_autoincrement": True} id = Column(Integer, primary_key=True) event_type = Column(String, nullable=False) payload = Column(Text, nullable=False) target_user_ids = Column(Text, nullable=True) created_at = Column(String, nullable=False, index=True)