oms/backend/database/migrations/20260909001800-update-product-menu-components.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

40 lines
1.3 KiB
JavaScript

'use strict';
/**
* 将「商品管理」下的「商品」「组合商品」菜单由占位页 views/Generic.vue
* 分别指向真实页面 views/Product/Index.vue 与 views/ComboProduct/Index.vue。
* 幂等:仅当 component 仍为占位页时才更新。
*/
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(
`UPDATE menus SET component = ? WHERE name = ? AND path = ? AND type = 2 AND component = ?`,
{
replacements: ['views/Product/Index.vue', '商品', '/product', 'views/Generic.vue'],
},
);
await queryInterface.sequelize.query(
`UPDATE menus SET component = ? WHERE name = ? AND path = ? AND type = 2 AND component = ?`,
{
replacements: [
'views/ComboProduct/Index.vue',
'组合商品',
'/combo-product',
'views/Generic.vue',
],
},
);
},
async down(queryInterface) {
await queryInterface.sequelize.query(
`UPDATE menus SET component = ? WHERE name = ? AND path = ? AND type = 2`,
{ replacements: ['views/Generic.vue', '商品', '/product'] },
);
await queryInterface.sequelize.query(
`UPDATE menus SET component = ? WHERE name = ? AND path = ? AND type = 2`,
{ replacements: ['views/Generic.vue', '组合商品', '/combo-product'] },
);
},
};