oms/backend/database/migrations/20260916030400-sync-order-status-columns.js
liufumingren 6c03a20364 feat(backend): 订单状态分表、WMS 推送与归档
- 新增 order_index 索引表 + 6 张同构状态表(待审核/异常/委外中/配送/已作废/已取消)与历史表,
  订单 ID 全局唯一,状态由业务事务推动:审核、驳回、取消、作废、恢复、归档
- 明细表 order_status_items、收件人文本智能解析、批量切换仓库/店铺并刷新快照
- WMS deliveryorder.create 推送(单条/批量)、推送失败定时重试、订单归档定时任务
- 迁移:建表、旧发货单数据迁入新表、菜单合并与迁移记录清理
- routes / swagger contract 补充订单状态接口

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-30 23:06:18 +08:00

28 lines
1020 B
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';
/**
* 订单表字段同步(把 app/lib/orderFields.js 里的字段定义补齐到已存在的表上)。
*
* 用途:字段定义是唯一来源(app/lib/orderFields.js),建表由 20260916030000 / 20260916030300 完成;
* 后续任何字段增补,只需在该文件里加字段定义 + 新建一条本文件同款迁移(调用 syncColumns)即可,
* 无需手写 ALTER(列已存在则跳过,幂等)。
*
* 本次补齐:orders / order_deliveries 的 status 是数值枚举、而流程状态是新枚举,
* 为不丢老值新增 `legacy_status`(迁移来源的老状态原值)。
*
* down:不可逆(仅补齐列,删除列会丢数据)。
*
* 执行:npm run migration:up
*/
const { syncColumns } = require('../orderStatusTables');
module.exports = {
async up(queryInterface, Sequelize) {
await syncColumns(queryInterface, Sequelize);
},
async down() {
// 不可逆:字段同步只做补齐,不回退(回退会丢数据)
},
};