WMS_MAIN/database/migrations/20260806120000-add-ai-thoughts-to-inbox-message.js

28 lines
886 B
JavaScript

'use strict';
/**
* 为 wms_inbox_message 新增 ai_thoughts 字段。
* 存储 AI 多轮推理的思考过程数组。
*/
module.exports = {
// eslint-disable-next-line no-unused-vars
up: async (queryInterface, Sequelize) => {
const tableInfo = await queryInterface.describeTable('wms_inbox_message');
if (!tableInfo.ai_thoughts) {
await queryInterface.addColumn('wms_inbox_message', 'ai_thoughts', {
type: Sequelize.JSON,
allowNull: true,
comment: 'AI 多轮推理思考过程 [{round,action,function,params,reason,functionResult}]',
});
}
},
// eslint-disable-next-line no-unused-vars
down: async queryInterface => {
const tableInfo = await queryInterface.describeTable('wms_inbox_message');
if (tableInfo.ai_thoughts) {
await queryInterface.removeColumn('wms_inbox_message', 'ai_thoughts');
}
},
};