Add Exception model

This commit is contained in:
Backend IM Bot 2025-03-28 17:12:59 +00:00
parent b0def99f22
commit 4c61b7fcfe

18
models/exception.py Normal file
View File

@ -0,0 +1,18 @@
from sqlalchemy import Column, String, DateTime, Text
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.sql import func
from core.database import Base
import uuid
class Exception(Base):
__tablename__ = "exceptions"
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
endpoint = Column(String, nullable=False)
method = Column(String, nullable=False)
status_code = Column(String, nullable=False)
error_message = Column(Text, nullable=True)
stack_trace = Column(Text, nullable=True)
request_data = Column(Text, nullable=True)
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())