WMS_MAIN/database/migrations/20260916191000-add-reply-fields.js
liufumingren c2a761ca26 feat(inbox): 新增开门/到货/进场/离场车牌登记与 extend_props 持久化
- functions 新增 openDoor/registerLicensePlate/enter/departure(规则表+权限分组)
- 到货登记表 wms_inbox_arrival_register(含消费字段,离场闭环,货主收货群优先推送)
- 回执 extend_props 持久化落库与定时补发送下发(重推兜底回读)
- 车牌提取正则兼容异体字(粤/粵)
- 售后类型/关键字/函数/回复 v2 模型与迁移
- INBOX V2 HTTP 测试报告与指南
2026-09-17 02:41:43 +08:00

55 lines
1.8 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';
/**
* 给 wms_after_sale_reply 补两列(开发库补丁,生产幂等跳过)。
*
* 背景:20260916190000 建表迁移在开发库执行后补充了两个字段设计——
* - is_reply:是否回复(1=命中后回复,0=静默不回复)
* - no_number_hint:未取到单据号时的引导语
* 原迁移文件已同步更新,生产执行时会直接带两列,本迁移在生产幂等跳过。
*/
const TABLE = 'wms_after_sale_reply';
module.exports = {
up: async (queryInterface, Sequelize) => {
const tables = await queryInterface.showAllTables();
const exists = tables.some(t => (typeof t === 'string' ? t : t.tableName) === TABLE);
if (!exists) return;
const columns = await queryInterface.describeTable(TABLE);
if (!columns.is_reply) {
await queryInterface.addColumn(TABLE, 'is_reply', {
type: Sequelize.TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '是否回复:1=命中后回复,0=静默不回复',
after: 'reply',
});
}
if (!columns.no_number_hint) {
await queryInterface.addColumn(TABLE, 'no_number_hint', {
type: Sequelize.STRING(500),
allowNull: true,
defaultValue: null,
comment: '未取到单据号时的引导语(如:请提供运单号;为空则用默认引导语)',
after: 'is_reply',
});
}
},
down: async queryInterface => {
const tables = await queryInterface.showAllTables();
const exists = tables.some(t => (typeof t === 'string' ? t : t.tableName) === TABLE);
if (!exists) return;
const columns = await queryInterface.describeTable(TABLE);
if (columns.no_number_hint) {
await queryInterface.removeColumn(TABLE, 'no_number_hint');
}
if (columns.is_reply) {
await queryInterface.removeColumn(TABLE, 'is_reply');
}
},
};