19 lines
517 B
Python
19 lines
517 B
Python
from sqlalchemy import Column, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Item(Base):
|
|
"""
|
|
Item model for storing item information.
|
|
"""
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String(100), index=True, nullable=False)
|
|
description = Column(Text)
|
|
owner_id = Column(Integer, ForeignKey("user.id"))
|
|
|
|
# Define relationship with User
|
|
owner = relationship("User", back_populates="items")
|