WMS_MAIN/database/migrations/20260807120000-add-express-code-to-wms-order-stockout.js

45 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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');
}
},
};