From 03a20bf4c14e64c41f81144bc14dc0882cc8212b Mon Sep 17 00:00:00 2001 From: Leopoldadmin Date: Tue, 9 Jun 2026 23:30:55 +0000 Subject: [PATCH] Add backend/app/models/comment.py --- backend/app/models/comment.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backend/app/models/comment.py diff --git a/backend/app/models/comment.py b/backend/app/models/comment.py new file mode 100644 index 0000000..37e0fb4 --- /dev/null +++ b/backend/app/models/comment.py @@ -0,0 +1,19 @@ +"""Comment model.""" +from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Text +from sqlalchemy.orm import relationship +from datetime import datetime +from app.database import Base + +class Comment(Base): + """Comment model.""" + __tablename__ = "comments" + + id = Column(Integer, primary_key=True, index=True) + content = Column(Text, nullable=False) + author_id = Column(Integer, ForeignKey("users.id"), nullable=False) + table_id = Column(Integer, ForeignKey("tables.id"), nullable=True) + record_id = Column(Integer, nullable=True) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + + author = relationship("User", back_populates="comments")