1234567891011121314151617 |
- from .Base import Base
- from datetime import datetime
- from sqlalchemy.orm import relationship
- from sqlalchemy import Column, Integer, ForeignKey, DateTime, String
- class Conversation(Base):
- __tablename__ = "conversations"
- id = Column(Integer, primary_key=True)
- user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
- created_at = Column(DateTime, default=datetime.now)
- summary = Column(String(50), nullable=False)
- user = relationship("User", back_populates="conversations")
- messages = relationship("Message", back_populates="conversation")
|