-- Lite 化流程兼容补丁：原材料驱动、客供料入库、无订单发货。
ALTER TABLE pp_work_order
    MODIFY COLUMN work_order_no VARCHAR(80) NOT NULL COMMENT '生产跟踪号/历史生产工单号';

ALTER TABLE so_delivery
    MODIFY COLUMN sales_order_id BIGINT NULL COMMENT '来源订单ID；lite模式下可为空',
    ADD COLUMN customer_id BIGINT NULL COMMENT '收货客户ID；无订单发货时必填' AFTER sales_order_id;

ALTER TABLE so_delivery_item
    MODIFY COLUMN sales_order_item_id BIGINT NULL COMMENT '来源订单明细ID；lite模式下可为空';

CREATE INDEX idx_so_delivery_customer_id ON so_delivery (customer_id);
