47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* 为打印记录表新增自定义打印任务编码字段。
|
|
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
|
|
* @param {import('sequelize')} Sequelize Sequelize 实例
|
|
* @return {Promise<void>} 无返回值
|
|
*/
|
|
module.exports = {
|
|
/**
|
|
* 执行迁移:新增 print_task_code 字段(幂等)。
|
|
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
|
|
* @param {import('sequelize')} Sequelize Sequelize 实例
|
|
* @return {Promise<void>} 无返回值
|
|
*/
|
|
async up(queryInterface, Sequelize) {
|
|
const tableName = 'wms_print_record';
|
|
const columns = await queryInterface.describeTable(tableName);
|
|
|
|
if (columns.print_task_code) {
|
|
return;
|
|
}
|
|
|
|
await queryInterface.addColumn(tableName, 'print_task_code', {
|
|
type: Sequelize.TEXT,
|
|
allowNull: true,
|
|
comment: '自定义打印任务编码,多个编码以逗号分隔',
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 回滚迁移:删除 print_task_code 字段(幂等)。
|
|
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
|
|
* @return {Promise<void>} 无返回值
|
|
*/
|
|
async down(queryInterface) {
|
|
const tableName = 'wms_print_record';
|
|
const columns = await queryInterface.describeTable(tableName);
|
|
|
|
if (!columns.print_task_code) {
|
|
return;
|
|
}
|
|
|
|
await queryInterface.removeColumn(tableName, 'print_task_code');
|
|
},
|
|
};
|