'use strict'; module.exports = { /** * 删除已弃用的打印台快递关联表。 * @param {import('sequelize').QueryInterface} queryInterface 查询接口 * @param {import('sequelize')} Sequelize Sequelize 实例 * @return {Promise} 无返回值 */ async up(queryInterface, Sequelize) { await queryInterface.sequelize.query( 'DROP TABLE IF EXISTS `wms_print_station_express`' ); }, /** * 回滚重建打印台快递关联表(核心字段与唯一索引)。 * @param {import('sequelize').QueryInterface} queryInterface 查询接口 * @param {import('sequelize')} Sequelize Sequelize 实例 * @return {Promise} 无返回值 */ async down(queryInterface, Sequelize) { await queryInterface.createTable('wms_print_station_express', { id: { type: Sequelize.INTEGER.UNSIGNED, autoIncrement: true, primaryKey: true, allowNull: false, comment: '主键ID', }, print_station_id: { type: Sequelize.STRING(255), allowNull: false, comment: '打印台ID', }, express_id: { type: Sequelize.STRING(255), allowNull: false, comment: '快递公司ID', }, express_name: { type: Sequelize.STRING(255), allowNull: true, comment: '快递公司名称', }, printer_name: { type: Sequelize.STRING(255), allowNull: true, comment: '打印机名称', }, creator_id: { type: Sequelize.BIGINT.UNSIGNED, allowNull: true, comment: '创建人ID', }, creator_name: { type: Sequelize.STRING(255), allowNull: true, comment: '创建人名称', }, create_at: { type: Sequelize.DATE, allowNull: true, comment: '创建时间', }, update_at: { type: Sequelize.DATE, allowNull: true, comment: '更新时间', }, deleted: { type: Sequelize.TINYINT, allowNull: false, defaultValue: 0, comment: '删除标记:0未删除,1已删除', }, }); await queryInterface.addIndex('wms_print_station_express', { fields: [ 'print_station_id', 'express_id', 'deleted' ], unique: true, name: 'uk_print_station_express', }); }, };