'use strict'; const TABLE = 'wms_order_stockout'; /** * 为出库单主表添加运单号字段。 * * - express_code:回传运单号(单个),奇门 stockout.confirm 回传时使用,为空则拒绝确认 * - express_codes:运单号列表(JSON 数组),支持多包裹场景 */ module.exports = { up: async (queryInterface, Sequelize) => { const columns = await queryInterface.describeTable(TABLE); if (!columns.express_code) { await queryInterface.addColumn(TABLE, 'express_code', { type: Sequelize.STRING(50), allowNull: true, comment: '回传运单号(奇门 stockout.confirm 回传使用,为空则拒绝确认)', }); } if (!columns.express_codes) { await queryInterface.addColumn(TABLE, 'express_codes', { type: Sequelize.JSON, allowNull: true, comment: '运单号列表(JSON 数组,支持多包裹场景)', }); } }, down: async queryInterface => { const columns = await queryInterface.describeTable(TABLE); if (columns.express_code) { await queryInterface.removeColumn(TABLE, 'express_code'); } if (columns.express_codes) { await queryInterface.removeColumn(TABLE, 'express_codes'); } }, };