WMS_MAIN/database/migrations/20260715230000-create-wms-pack-task-video.js
liufumingren b485f8e9f1 feat(camera): 新增摄像头/录制模块 (camera/camera_server/pack_task_video)
- 新增 model: camera, camera_server

- 新增 services: camera, cameraServer (systemMethods + systems)

- 新增 pack_task_video 表及录制状态管理

- 7 条迁移: 建表→设备字段→端口拆分→状态枚举
2026-07-27 03:46:51 +08:00

73 lines
2.1 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';
const TABLE_NAME = 'wms_pack_task_video';
module.exports = {
up: async (queryInterface, Sequelize) => {
const tables = await queryInterface.showAllTables();
const exists = tables.some(t => (typeof t === 'string' ? t : t.tableName) === TABLE_NAME);
if (exists) return;
await queryInterface.createTable(TABLE_NAME, {
id: {
type: Sequelize.BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
pack_task_id: {
type: Sequelize.BIGINT(20).UNSIGNED,
allowNull: false,
comment: '打包任务ID,关联 wms_pack_task.id',
},
camera_id: {
type: Sequelize.BIGINT(20).UNSIGNED,
allowNull: true,
comment: '摄像头设备ID,关联 wms_camera.id',
},
video_url: {
type: Sequelize.STRING(500),
allowNull: false,
comment: '视频地址(录像回放URL)',
},
status: {
type: Sequelize.TINYINT,
allowNull: false,
defaultValue: 1,
comment: '状态:0-无效 1-有效',
},
remark: {
type: Sequelize.STRING(500),
allowNull: true,
comment: '备注',
},
created_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
updated_at: {
type: Sequelize.DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
comment: '更新时间',
},
deleted_at: {
type: Sequelize.DATE,
allowNull: true,
comment: '软删除时间',
},
});
await queryInterface.addIndex(TABLE_NAME, ['pack_task_id'], { name: 'idx_pack_task_id' });
await queryInterface.addIndex(TABLE_NAME, ['camera_id'], { name: 'idx_camera_id' });
await queryInterface.addIndex(TABLE_NAME, ['deleted_at'], { name: 'idx_deleted_at' });
},
down: async queryInterface => {
await queryInterface.dropTable(TABLE_NAME);
},
};