WMS_MAIN/database/migrations/20260930150000-remove-check-date-from-wms-stock-check.js
liufumingren 190d3cf9e5 feat(stock.check): 盘点模块功能扩展并同步接口文档(0.3.227)
- 盘点明细/记录支持未知商品(stock_id 可空)与库位范围,模式/状态口径修正
- 新增静态盘点任务、公告相关模型与迁移,stock_warehouse 增加预警数量
- methods/system.json 同步盘点接口文档;headers platform 微信端取值 wx 修正为 miniprogram
2026-10-02 15:43:49 +08:00

57 lines
1.7 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';
/**
* 盘点主表时间字段调整:
* 1. 移除盘点日期 check_date(及其联合索引 idx_warehouse_check_date)——
* 创建任务不再传盘点时间,盘点时间线由 start_time/end_time 表达。
* 2. start_time(盘点开始时间:第一个盘点明细写入时间)与
* end_time(盘点结束时间:完成盘点时间)注释对齐新语义,类型不变。
*/
const TABLE_NAME = 'wms_stock_check';
module.exports = {
up: async (queryInterface, Sequelize) => {
const { DATE } = Sequelize;
// 先删索引再删列
await queryInterface.removeIndex(TABLE_NAME, 'idx_warehouse_check_date');
await queryInterface.removeColumn(TABLE_NAME, 'check_date');
await queryInterface.changeColumn(TABLE_NAME, 'start_time', {
type: DATE,
allowNull: true,
comment: '盘点开始时间(第一个盘点明细写入的时间)',
});
await queryInterface.changeColumn(TABLE_NAME, 'end_time', {
type: DATE,
allowNull: true,
comment: '盘点结束时间(完成盘点的时间)',
});
},
down: async (queryInterface, Sequelize) => {
const { DATE } = Sequelize;
await queryInterface.addColumn(TABLE_NAME, 'check_date', {
type: DATE,
allowNull: false,
comment: '盘点日期',
});
await queryInterface.addIndex(TABLE_NAME, [ 'warehouse_id', 'check_date' ], {
name: 'idx_warehouse_check_date',
});
await queryInterface.changeColumn(TABLE_NAME, 'start_time', {
type: DATE,
allowNull: true,
comment: '实际开始时间',
});
await queryInterface.changeColumn(TABLE_NAME, 'end_time', {
type: DATE,
allowNull: true,
comment: '实际结束时间',
});
},
};