'use strict'; /** * 为快递接口配置表新增是否隐藏物品信息字段。 * @param {import('sequelize').QueryInterface} queryInterface 查询接口 * @param {import('sequelize')} Sequelize Sequelize 实例 * @return {Promise} 无返回值 */ module.exports = { /** * 执行迁移:新增 is_hide_goods 字段(幂等)。 * @param {import('sequelize').QueryInterface} queryInterface 查询接口 * @param {import('sequelize')} Sequelize Sequelize 实例 * @return {Promise} 无返回值 */ async up(queryInterface, Sequelize) { const tableName = 'wms_express_interface'; const columns = await queryInterface.describeTable(tableName); if (columns.is_hide_goods) { return; } await queryInterface.addColumn(tableName, 'is_hide_goods', { type: Sequelize.TINYINT(1), allowNull: true, defaultValue: 0, comment: '是否隐藏物品信息', }); }, /** * 回滚迁移:删除 is_hide_goods 字段(幂等)。 * @param {import('sequelize').QueryInterface} queryInterface 查询接口 * @return {Promise} 无返回值 */ async down(queryInterface) { const tableName = 'wms_express_interface'; const columns = await queryInterface.describeTable(tableName); if (!columns.is_hide_goods) { return; } await queryInterface.removeColumn(tableName, 'is_hide_goods'); }, };