feat(shipping-notice): 添加 RPA 工作者心跳告警开关,更新环境配置以支持样本证据历史记录

This commit is contained in:
hugo committed 2026-07-19 23:15:25 +08:00
1 parent 705971ad03
commit 88408490d7
34 files changed
+1697 -109

No files matched your search

@@ -0,0 +1,23 @@
"""记录库存映射草稿的样本替换审计。"""
from alembic import op
import sqlalchemy as sa
revision = 'a4c7e9f1b2d3'
down_revision = 'fd2e3f4a5b6c'
branch_labels = None
depends_on = None
def upgrade() -> None:
"""保留样本证据的替换链,避免草稿更新后丢失配置依据。"""
op.add_column(
'shipping_inventory_parsing_profiles',
sa.Column('sample_evidence_history_json', sa.JSON(), server_default=sa.text("'[]'"), nullable=False),
)
def downgrade() -> None:
"""移除样本替换历史字段。"""
op.drop_column('shipping_inventory_parsing_profiles', 'sample_evidence_history_json')
@@ -0,0 +1,35 @@
"""将库存映射样本改为最小化结构证据。"""
from alembic import op
import sqlalchemy as sa
revision = 'fc1d2e3f4a5b'
down_revision = 'fb1c2d3e4f5a'
branch_labels = None
depends_on = None
def upgrade() -> None:
"""保存脱敏样例和 Profile 样本引用,不再要求分析记录持有完整 Excel 路径。"""
with op.batch_alter_table('shipping_inventory_structure_analyses') as batch:
batch.alter_column('storage_path', existing_type=sa.String(length=500), nullable=True)
batch.add_column(sa.Column('sample_rows_json', sa.JSON(), server_default=sa.text("'[]'"), nullable=False))
with op.batch_alter_table('shipping_inventory_parsing_profiles') as batch:
batch.add_column(sa.Column('sample_analysis_id', sa.Integer(), nullable=True))
batch.create_index('ix_shipping_inventory_parsing_profiles_sample_analysis_id', ['sample_analysis_id'])
batch.create_foreign_key(
'fk_inventory_parsing_profiles_sample_analysis',
'shipping_inventory_structure_analyses', ['sample_analysis_id'], ['id'],
)
def downgrade() -> None:
"""移除样本证据引用;旧版重新要求结构分析记录保存来源路径。"""
with op.batch_alter_table('shipping_inventory_parsing_profiles') as batch:
batch.drop_constraint('fk_inventory_parsing_profiles_sample_analysis', type_='foreignkey')
batch.drop_index('ix_shipping_inventory_parsing_profiles_sample_analysis_id')
batch.drop_column('sample_analysis_id')
with op.batch_alter_table('shipping_inventory_structure_analyses') as batch:
batch.drop_column('sample_rows_json')
batch.alter_column('storage_path', existing_type=sa.String(length=500), nullable=False)
@@ -0,0 +1,24 @@
"""锁定库存站点测试使用的 RPA Profile 配置版本。"""
from alembic import op
import sqlalchemy as sa
revision = 'fd2e3f4a5b6c'
down_revision = 'fc1d2e3f4a5b'
branch_labels = None
depends_on = None
def upgrade() -> None:
"""为既有测试运行补充连接版本快照,使凭据或登录配置变更能够使测试失效。"""
with op.batch_alter_table('shipping_inventory_configuration_test_runs') as batch:
batch.add_column(sa.Column(
'rpa_profile_config_version', sa.Integer(), nullable=False, server_default=sa.text('1'),
))
def downgrade() -> None:
"""移除 RPA Profile 配置版本快照。"""
with op.batch_alter_table('shipping_inventory_configuration_test_runs') as batch:
batch.drop_column('rpa_profile_config_version')