1234567891011121314151617 |
- from typing import TYPE_CHECKING
- from sqlalchemy import Column, ForeignKey, Integer, String, Text
- from sqlalchemy.orm import relationship
- from app.db.base_class import Base
- if TYPE_CHECKING:
- from .user import User # noqa: F401
- class Item(Base):
- id = Column(Integer, primary_key=True, index=True)
- title = Column(String(30), index=True)
- description = Column(Text)
- owner_id = Column(Integer, ForeignKey("user.id"))
- owner = relationship("User", back_populates="items")
|