WMS_MAIN/database/migrations/20260813120200-create-wms-return-unpack-video.js
liufumingren 38b29be776 feat: 新增退回拆包模块(returnUnpack)与序列表原子取号
- 新增 wms_return_unpack 主表/明细/视频 与 wms_return_query_log 表(model + 迁移)
- 新增序列表 wms_number_sequence,单号取号改为 INSERT...ON DUPLICATE KEY 原子递增(含历史 seed 对齐)
- 补齐 wms_order_delivery 基表缺失 25 列(修复 Unknown column)
- 权限固定 ID 540-549 + 角色授权迁移
- 修复 returnReceived.create 出参 record 包装;修复 afterSale 发件人查询列名(name→company_name)
- detail 接口按设计走 548 权限校验
2026-08-13 21:40:50 +08:00

67 lines
2.2 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';
/**
* 创建退回拆包视频记录表 wms_return_unpack_video(参考 wms_pack_task_video)。
*
* 字段:关联主表 unpack_id、摄像头 camera_id(非必填)、视频地址 video_url、状态 status、
* 备注 remark、软删除 deleted_at(paranoid)。
*
* 索引:idx_unpack_id(按拆包单查视频)、idx_camera_id(按摄像头反查)、idx_deleted_at(软删除优化)。
*/
const TABLE_NAME = 'wms_return_unpack_video';
module.exports = {
// eslint-disable-next-line no-unused-vars
async up(queryInterface, Sequelize) {
const { BIGINT, STRING, DATE, ENUM } = Sequelize;
await queryInterface.createTable(TABLE_NAME, {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
unpack_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '关联拆包主表 wms_return_unpack.id',
},
camera_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
comment: '摄像头设备ID,关联 wms_camera.id',
},
video_url: {
type: STRING(500),
allowNull: false,
comment: '视频地址(录像回放URL)',
},
status: {
type: ENUM('created', 'recording', 'completed', 'failed'),
allowNull: false,
defaultValue: 'created',
comment: '状态:created/recording/completed/failed',
},
remark: {
type: STRING(500),
allowNull: true,
comment: '备注',
},
created_at: { type: DATE, allowNull: false },
updated_at: { type: DATE, allowNull: false },
deleted_at: { type: DATE, allowNull: true, comment: '软删除时间' },
});
await queryInterface.addIndex(TABLE_NAME, [ 'unpack_id' ], { name: 'idx_unpack_id' });
await queryInterface.addIndex(TABLE_NAME, [ 'camera_id' ], { name: 'idx_camera_id' });
await queryInterface.addIndex(TABLE_NAME, [ 'deleted_at' ], { name: 'idx_deleted_at' });
},
// eslint-disable-next-line no-unused-vars
async down(queryInterface, Sequelize) {
await queryInterface.dropTable(TABLE_NAME);
},
};