Add Exception model

This commit is contained in:
Backend IM Bot 2025-03-29 22:19:45 +00:00
parent bd71599914
commit 0bf08babc7

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)
error_code = Column(String(50), nullable=False)
error_message = Column(String(255), nullable=False)
stack_trace = Column(Text, nullable=True)
endpoint = Column(String(100), nullable=False)
method = Column(String(10), nullable=False)
request_data = Column(Text, nullable=True)
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())