oms/backend/database/migrations/20260909001400-fix-dashboard-first.js
liufumingren 8597cf5ac9 feat(backend): 用户鉴权、菜单权限、主体与系统基础模块
- 登录/邮箱验证码/密码流程(controller/auth.js、lib/emailCode.js、middleware/jwt_auth.js)
- 主体(principal)隔离与主体用户、对外接口配置模块及 principalCheck 中间件
- 菜单、用户、文件上传、快递公司字典(express_companies)等基础模块
- 通用工具:分页(lib/pagination.js)、缓存(service/cache.js)
- 全量接口契约(contract/index.js)与路由注册(router.js)、config.default.js 配置
- 相关迁移:菜单组件调整与菜单种子、创建 files 表
2026-09-13 02:23:34 +08:00

34 lines
979 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';
/**
* 菜单顺序调整:仪表盘固定在第一位,系统管理保持最后一位。
* 根菜单排序(sort DESC):仪表盘 100 > 订单管理 90 > 商品管理 80 > 外部仓库 75 > 系统管理 70。
*/
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(
`UPDATE menus SET sort = CASE name
WHEN '仪表盘' THEN 100
WHEN '订单管理' THEN 90
WHEN '商品管理' THEN 80
WHEN '外部仓库' THEN 75
WHEN '系统管理' THEN 70
ELSE sort END
WHERE parent_id = 0`,
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(
`UPDATE menus SET sort = CASE name
WHEN '仪表盘' THEN 80
WHEN '订单管理' THEN 100
WHEN '商品管理' THEN 90
WHEN '外部仓库' THEN 75
WHEN '系统管理' THEN 70
ELSE sort END
WHERE parent_id = 0`,
);
},
};