18 lines
603 B
Python
18 lines
603 B
Python
from sqlalchemy import Column, Integer, String, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from config.database import Base
|
|
|
|
|
|
class Equipment(Base):
|
|
__tablename__ = "equipment"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
scenario_id = Column(Integer, ForeignKey("scenario.id"), nullable=False)
|
|
name = Column(String, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
|
|
scenario = relationship("Scenario", back_populates="equipment_items")
|
|
|
|
def __repr__(self):
|
|
return f"<Equipment id={self.id} scenario_id={self.scenario_id} name={self.name}>"
|