'use strict'; /** * wms_after_sale_reply 增加 create_work_order 列(幂等)。 * * 语义:是否登记工单。1=函数正常创建售后工单(默认); * 0=函数照常执行(符合入参即执行),但函数内部跳过工单登记 * (引擎注入 ctx.inboxContext.skip_work_order 标记,建单函数在建单前检查)。 */ 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.create_work_order) return; await queryInterface.addColumn(TABLE, 'create_work_order', { type: Sequelize.TINYINT(1), allowNull: false, defaultValue: 1, comment: '是否登记工单:1=函数正常创建工单(默认),0=函数照常执行但内部跳过工单登记', after: 'is_reply', }); }, down: async () => { // 不回退(新列无副作用) }, };