1
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"""银行账户与定时任务
|
"""银行账户与定时任务
|
||||||
|
|
||||||
Revision ID: 20260813_bank_account_scheduled_task
|
Revision ID: 20260813_bank_account_scheduled_task
|
||||||
Revises: 20260813_split_device_type
|
Revises: 20260813_bank_api_log
|
||||||
Create Date: 2026-08-13 16:00:00.000000
|
Create Date: 2026-08-13 16:00:00.000000
|
||||||
"""
|
"""
|
||||||
from alembic import op
|
from alembic import op
|
||||||
@@ -9,7 +9,7 @@ import sqlalchemy as sa
|
|||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '20260813_bank_account_scheduled_task'
|
revision = '20260813_bank_account_scheduled_task'
|
||||||
down_revision = '20260813_split_device_type'
|
down_revision = '20260813_bank_api_log'
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
||||||
@@ -46,8 +46,30 @@ def upgrade():
|
|||||||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(), comment='更新时间'),
|
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now(), comment='更新时间'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 删除旧的银行接口请求记录表(日志改为文件存储)
|
||||||
|
op.drop_index('ix_bank_api_logs_created_at', table_name='bank_api_logs')
|
||||||
|
op.drop_index('ix_bank_api_logs_admin_id', table_name='bank_api_logs')
|
||||||
|
op.drop_table('bank_api_logs')
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
|
# 恢复 bank_api_logs 表
|
||||||
|
op.create_table(
|
||||||
|
'bank_api_logs',
|
||||||
|
sa.Column('id', sa.String(32), primary_key=True),
|
||||||
|
sa.Column('request_type', sa.String(32), nullable=False, comment='请求类型'),
|
||||||
|
sa.Column('request_params', sa.Text, nullable=True, comment='请求参数 JSON'),
|
||||||
|
sa.Column('response_data', sa.Text, nullable=True, comment='响应数据 JSON'),
|
||||||
|
sa.Column('status_code', sa.Integer, nullable=True, comment='HTTP 状态码'),
|
||||||
|
sa.Column('is_success', sa.Boolean, default=True, comment='是否成功'),
|
||||||
|
sa.Column('error_msg', sa.Text, nullable=True, comment='错误信息'),
|
||||||
|
sa.Column('admin_id', sa.String(32), nullable=True, comment='操作管理员 ID'),
|
||||||
|
sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
|
)
|
||||||
|
op.create_index('ix_bank_api_logs_admin_id', 'bank_api_logs', ['admin_id'])
|
||||||
|
op.create_index('ix_bank_api_logs_created_at', 'bank_api_logs', ['created_at'])
|
||||||
|
|
||||||
# 删除新表
|
# 删除新表
|
||||||
op.drop_table('scheduled_tasks')
|
op.drop_table('scheduled_tasks')
|
||||||
op.drop_table('bank_accounts')
|
op.drop_table('bank_accounts')
|
||||||
|
|||||||
Reference in New Issue
Block a user