41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
'use strict';
|
||
|
||
const TABLE = 'wms_entry_order';
|
||
|
||
/**
|
||
* 入库单主表新增 is_virtual_inbound 字段:
|
||
* 标记该入库单是否为虚拟入库(0=否,1=是)。
|
||
* 快捷直入时,无绑定收货单的入库单为虚拟入库,有绑定收货单的为非虚拟入库。
|
||
*/
|
||
module.exports = {
|
||
/**
|
||
* 执行迁移:新增 is_virtual_inbound 字段。
|
||
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
|
||
* @param {import('sequelize')} Sequelize Sequelize 实例
|
||
* @return {Promise<void>} 无返回值
|
||
*/
|
||
up: async (queryInterface, Sequelize) => {
|
||
const columns = await queryInterface.describeTable(TABLE);
|
||
if (!columns.is_virtual_inbound) {
|
||
await queryInterface.addColumn(TABLE, 'is_virtual_inbound', {
|
||
type: Sequelize.TINYINT(1),
|
||
allowNull: false,
|
||
defaultValue: 0,
|
||
comment: '是否虚拟入库:0=否 1=是',
|
||
});
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 回滚迁移:删除 is_virtual_inbound 字段。
|
||
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
|
||
* @return {Promise<void>} 无返回值
|
||
*/
|
||
down: async queryInterface => {
|
||
const columns = await queryInterface.describeTable(TABLE);
|
||
if (columns.is_virtual_inbound) {
|
||
await queryInterface.removeColumn(TABLE, 'is_virtual_inbound');
|
||
}
|
||
},
|
||
};
|