WMS_MAIN/database/migrations/20260514123000-drop-wms_print_station_express.js
liufumingren 9845a239e2 1
2026-05-16 02:44:53 +08:00

86 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
module.exports = {
/**
* 删除已弃用的打印台快递关联表。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口
* @param {import('sequelize')} Sequelize Sequelize 实例
* @return {Promise<void>} 无返回值
*/
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<void>} 无返回值
*/
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',
});
},
};