- 客户主数据新增 odm_ids 白名单字段(含 Alembic 迁移),表单与管理端支持维护 - 导出库存命中行按客户白名单与整单 ODM 裁决收敛,新增 notice_odm_choice_service - 工作台新增 odm-options / odm-choice 接口,投影行级候选并持久化用户选择 - 修复复核工作台跨 Run 切换时接收解析上下文残留 - 同步四语言 i18n、测试用例、funclist 与 shipping-notice 技术文档
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
"""customer odm scope: add odm_ids to shipping_customers
|
|
|
|
Revision ID: aa11bb22cc33
|
|
Revises: fb26bc033d27
|
|
Create Date: 2026-09-16 00:00:00.000000
|
|
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = "aa11bb22cc33"
|
|
down_revision = "fb26bc033d27"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def _add_column(insp, table: str, column: sa.Column) -> None:
|
|
if table not in set(insp.get_table_names()):
|
|
return
|
|
columns = {col["name"] for col in insp.get_columns(table)}
|
|
if column.name not in columns:
|
|
with op.batch_alter_table(table, schema=None) as batch_op:
|
|
batch_op.add_column(column)
|
|
|
|
|
|
def _drop_column(insp, table: str, name: str) -> None:
|
|
if table not in set(insp.get_table_names()):
|
|
return
|
|
columns = {col["name"] for col in insp.get_columns(table)}
|
|
if name in columns:
|
|
with op.batch_alter_table(table, schema=None) as batch_op:
|
|
batch_op.drop_column(name)
|
|
|
|
|
|
def upgrade():
|
|
insp = sa.inspect(op.get_bind())
|
|
_add_column(
|
|
insp,
|
|
"shipping_customers",
|
|
sa.Column("odm_ids", sa.JSON(), nullable=True),
|
|
)
|
|
_add_column(
|
|
insp,
|
|
"shipping_notice_line_inventory_matches",
|
|
sa.Column("chosen_odm_id", sa.String(length=64), nullable=True),
|
|
)
|
|
|
|
|
|
def downgrade():
|
|
insp = sa.inspect(op.get_bind())
|
|
_drop_column(insp, "shipping_notice_line_inventory_matches", "chosen_odm_id")
|
|
_drop_column(insp, "shipping_customers", "odm_ids")
|