Add migration for Exception
This commit is contained in:
parent
e428b1aa5a
commit
51b854521e
@ -0,0 +1,33 @@
|
|||||||
|
"""create exceptions table
|
||||||
|
|
||||||
|
Revision ID: a2b3c4d5e6f7
|
||||||
|
Revises: 0001
|
||||||
|
Create Date: 2024-03-26 12:00:00.000000
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects.postgresql import UUID
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
|
||||||
|
# revision identifiers
|
||||||
|
revision = 'a2b3c4d5e6f7'
|
||||||
|
down_revision = '0001'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
op.create_table(
|
||||||
|
'exceptions',
|
||||||
|
sa.Column('id', UUID(as_uuid=True), primary_key=True),
|
||||||
|
sa.Column('error_code', sa.String(50), nullable=False),
|
||||||
|
sa.Column('error_message', sa.String(255), nullable=False),
|
||||||
|
sa.Column('stack_trace', sa.Text, nullable=True),
|
||||||
|
sa.Column('endpoint', sa.String(100), nullable=False),
|
||||||
|
sa.Column('method', sa.String(10), nullable=False),
|
||||||
|
sa.Column('request_data', sa.Text, nullable=True),
|
||||||
|
sa.Column('created_at', sa.DateTime, server_default=sa.func.now(), nullable=False),
|
||||||
|
sa.Column('updated_at', sa.DateTime, server_default=sa.func.now(), onupdate=sa.func.now(), nullable=False)
|
||||||
|
)
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
op.drop_table('exceptions')
|
Loading…
x
Reference in New Issue
Block a user