sysom1/sysom_server/sysom_log/alembic/versions/f8dadcca667f_init.py

55 lines
2.3 KiB
Python

"""init
Revision ID: f8dadcca667f
Revises:
Create Date: 2023-07-27 11:21:37.037622
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f8dadcca667f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('sys_audit_log',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ts', sa.Integer(), nullable=True, comment='时间戳'),
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_at', sa.DateTime(), nullable=True, comment='更新时间'),
sa.Column('methond', sa.String(length=32), nullable=True, comment='请求方法'),
sa.Column('ip', sa.String(length=32), nullable=True, comment='请求IP地址'),
sa.Column('path', sa.String(length=128), nullable=True, comment='路径'),
sa.Column('browser_agent', sa.String(length=256), nullable=True, comment='客户端信息'),
sa.Column('handler', sa.String(length=64), nullable=True, comment='处理视图'),
sa.Column('status', sa.Integer(), nullable=True, comment='状态码'),
sa.Column('request_type', sa.String(length=32), nullable=True, comment='请求类型'),
sa.Column('user', sa.Integer(), nullable=True, comment='操作用户'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('sys_node_log',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('ts', sa.Integer(), nullable=True, comment='时间戳'),
sa.Column('create_at', sa.DateTime(), nullable=True, comment='创建时间'),
sa.Column('update_at', sa.DateTime(), nullable=True, comment='更新时间'),
sa.Column('instance', sa.String(length=32), nullable=True, comment='节点ID'),
sa.Column('event_type', sa.String(length=64), nullable=True, comment='异常类型'),
sa.Column('description', sa.Text(), nullable=True, comment='日志描述'),
sa.Column('extra', sa.Text(), nullable=True, comment='日志额外信息'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('sys_node_log')
op.drop_table('sys_audit_log')
# ### end Alembic commands ###