'use strict'; /** * wms_inbox_message 增加 extend_props 列(回执扩展属性持久化,幂等)。 * * 背景:出站回执 notify.reply 的 extend_props(如开门指令等空文案回执的驱动属性) * 此前只在首推时随报文发出,不落库。手动/定时重推时无法恢复 extend_props, * 且 content 为空的 extend_props 回执被重推扫描直接跳过。加列后: * - 首推写库持久化;重推从记录原样带回; * - 空文案但含 extend_props 的出站记录可被重推。 */ const TABLE = 'wms_inbox_message'; 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.extend_props) return; await queryInterface.addColumn(TABLE, 'extend_props', { type: Sequelize.JSON, allowNull: true, defaultValue: null, comment: '回执扩展属性(notify.reply 的 extend_props),重推时原样带回', after: 'ext_data', }); }, down: async () => { // 不回退(新列无副作用) }, };