Files
freetable/backend/app/models/comment.py
T

20 lines
769 B
Python
Raw Normal View History

2026-06-09 23:30:55 +00:00
"""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")