WMS_MAIN/database/migrations/20260529110000-add-sph-xhs-dw-jd-to-wms-express.js
liufumingren 4beefcd22c feat(print,docs,migrations): add notifyLock, order export, express fields and related docs
notifyLock method + logs

print.send logs

order export methods + docs

express model fields SPH/XHS/DW/JD + migration

platform_shop_id migration

notifyLock docs

order export docs
2026-05-30 17:30:17 +08:00

79 lines
2.1 KiB
JavaScript

'use strict';
/**
* 为快递基础信息表新增 SPH/XHS/DW/JD 编码字段。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
* @param {import('sequelize')} Sequelize Sequelize 实例
* @return {Promise<void>} 无返回值
*/
module.exports = {
/**
* 执行迁移:新增 SPH/XHS/DW/JD 字段(幂等)。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
* @param {import('sequelize')} Sequelize Sequelize 实例
* @return {Promise<void>} 无返回值
*/
async up(queryInterface, Sequelize) {
const tableName = 'wms_express';
const columns = await queryInterface.describeTable(tableName);
if (!columns.SPH) {
await queryInterface.addColumn(tableName, 'SPH', {
type: Sequelize.STRING(255),
allowNull: true,
comment: 'SPH编码',
});
}
if (!columns.XHS) {
await queryInterface.addColumn(tableName, 'XHS', {
type: Sequelize.STRING(255),
allowNull: true,
comment: '小红书编码',
});
}
if (!columns.DW) {
await queryInterface.addColumn(tableName, 'DW', {
type: Sequelize.STRING(255),
allowNull: true,
comment: 'DW编码',
});
}
if (!columns.JD) {
await queryInterface.addColumn(tableName, 'JD', {
type: Sequelize.STRING(255),
allowNull: true,
comment: '京东编码',
});
}
},
/**
* 回滚迁移:删除 SPH/XHS/DW/JD 字段(幂等)。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
* @return {Promise<void>} 无返回值
*/
async down(queryInterface) {
const tableName = 'wms_express';
const columns = await queryInterface.describeTable(tableName);
if (columns.SPH) {
await queryInterface.removeColumn(tableName, 'SPH');
}
if (columns.XHS) {
await queryInterface.removeColumn(tableName, 'XHS');
}
if (columns.DW) {
await queryInterface.removeColumn(tableName, 'DW');
}
if (columns.JD) {
await queryInterface.removeColumn(tableName, 'JD');
}
},
};