diff --git a/app/models/issue.py b/app/models/issue.py index 5897506..52cffbb 100644 --- a/app/models/issue.py +++ b/app/models/issue.py @@ -64,3 +64,16 @@ class Issue(Base): # Relations organization = relationship("Organization", back_populates="issues") integration = relationship("Integration", back_populates="issues") + comments = relationship("IssueComment", back_populates="issue", cascade="all, delete-orphan") + +class IssueComment(Base): + __tablename__ = "issue_comments" + + id = Column(Integer, primary_key=True, index=True) + issue_id = Column(Integer, ForeignKey("issues.id"), nullable=False) + user_id = Column(Integer, ForeignKey("users.id"), nullable=True) + content = Column(Text, nullable=False) + created_at = Column(DateTime, default=datetime.utcnow) + + # Relations + issue = relationship("Issue", back_populates="comments")