'use strict'; /** * 创建到货登记表 wms_inbox_arrival_register。 * * 用途:货主/仓库群发送"到货+车牌号"时,AI 提取车牌号并登记, * 记录货主ID、仓库ID、登记时间(created_at)、车牌号。 * * 索引: * idx_warehouse_plate(仓库+车牌查询某车牌在该仓库的登记记录) * idx_store_id(按货主查询) */ module.exports = { // eslint-disable-next-line no-unused-vars async up(queryInterface, Sequelize) { const { BIGINT, STRING, DATE } = Sequelize; await queryInterface.createTable('wms_inbox_arrival_register', { id: { type: BIGINT(20).UNSIGNED, primaryKey: true, autoIncrement: true, allowNull: false, comment: '主键ID', }, warehouse_id: { type: BIGINT(20).UNSIGNED, allowNull: false, comment: '仓库ID(数据隔离维度)', }, store_id: { type: BIGINT(20).UNSIGNED, allowNull: true, comment: '货主ID(仓库群登记时无货主,允许为空)', }, license_plate: { type: STRING(20), allowNull: false, comment: '车牌号', }, created_at: { type: DATE, allowNull: false, comment: '登记时间' }, updated_at: { type: DATE, allowNull: false, comment: '更新时间' }, }); await queryInterface.addIndex('wms_inbox_arrival_register', [ 'warehouse_id', 'license_plate' ], { name: 'idx_warehouse_plate' }); await queryInterface.addIndex('wms_inbox_arrival_register', [ 'store_id' ], { name: 'idx_store_id' }); }, // eslint-disable-next-line no-unused-vars async down(queryInterface, Sequelize) { await queryInterface.dropTable('wms_inbox_arrival_register'); }, };