from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey from sqlalchemy.sql import func from app.core.config import Base class ActivityLog(Base): __tablename__ = "activity_logs" id = Column(Integer, primary_key=True, index=True) action = Column(String(50), nullable=False) # e.g. "issue.created", "comment.added" entity_type = Column(String(50), nullable=False) # "issue", "project", "comment" entity_id = Column(Integer, nullable=False) user_id = Column(Integer, ForeignKey("users.id"), nullable=True) details = Column(Text, nullable=True) # JSON string created_at = Column(DateTime(timezone=True), server_default=func.now())