123456789101112131415 |
- from sqlalchemy import Column, Integer, String, ForeignKey
- from sqlalchemy.orm import relationship
- from app.db.session import Base
- class Item(Base):
- __tablename__ = "items"
- id = Column(Integer, primary_key=True, index=True)
- title = Column(String, index=True)
- description = Column(String, index=True)
- owner_id = Column(Integer, ForeignKey("users.id"))
- owner = relationship("User", back_populates="items")
|