packServer/backend/database/migrations/20261018220000-add-workstation-record-range.js

47 lines
1.5 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';
/**
* 工作台录制范围
*
* - record_before_sec:触发点**之前**录多少秒
* 团购工作台 = 扫码时间之前
* 散单工作台 = 任务结束之前
* - record_after_sec:触发点**之后**录多少秒(同上对应关系)
* - record_max_sec:最大录制时长(默认 240 秒),超出按上限裁切
*
* 编号 code 不再让用户填(自动生成),列保留给唯一键与历史数据用。
*/
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('workstations', 'record_before_sec', {
type: Sequelize.INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 60,
after: 'ws_type',
comment: '录制范围:触发点之前秒数',
});
await queryInterface.addColumn('workstations', 'record_after_sec', {
type: Sequelize.INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 60,
after: 'record_before_sec',
comment: '录制范围:触发点之后秒数',
});
await queryInterface.addColumn('workstations', 'record_max_sec', {
type: Sequelize.INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 240,
after: 'record_after_sec',
comment: '最大录制时长(秒)',
});
},
async down(queryInterface) {
await queryInterface.removeColumn('workstations', 'record_max_sec');
await queryInterface.removeColumn('workstations', 'record_after_sec');
await queryInterface.removeColumn('workstations', 'record_before_sec');
},
};