item.py 433 B

123456789101112131415
  1. from sqlalchemy import Column, Integer, String, ForeignKey
  2. from sqlalchemy.orm import relationship
  3. from app.db.session import Base
  4. class Item(Base):
  5. __tablename__ = "items"
  6. id = Column(Integer, primary_key=True, index=True)
  7. title = Column(String, index=True)
  8. description = Column(String, index=True)
  9. owner_id = Column(Integer, ForeignKey("users.id"))
  10. owner = relationship("User", back_populates="items")