User.py 488 B

12345678910111213141516
  1. from .Base import Base
  2. from datetime import datetime
  3. from sqlalchemy.orm import relationship
  4. from sqlalchemy import Column, Integer, String, DateTime
  5. class User(Base):
  6. __tablename__ = "users"
  7. id = Column(Integer, primary_key=True)
  8. email = Column(String(100), unique=True, nullable=False)
  9. password_hash = Column(String(256), nullable=False)
  10. created_at = Column(DateTime, default=datetime.now)
  11. conversations = relationship("Conversation", back_populates="user")