oms/backend/database/migrations/20260916002100-add-is-system-to-product-brands.js
liufumingren d22f3e1f0a feat(backend): 新增商品分类/品牌/单位字典与属性菜单
- 按主体隔离的分类/品牌/单位 CRUD 与 /select 下拉接口
- 商品模型增加 brand_id / unit_id,属性被商品引用时禁止删除(attributeUsage)
- 迁移:建三张字典表、商品表加字段、种子属性菜单、is_system 保护内置项

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

22 lines
756 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';
/**
* 商品品牌表增加 is_system 字段(是否系统默认)。
* 系统数据:全部主体可见、不可改/删;自定义数据:按主体隔离(principal_id)。
* 说明:品牌不做预设系统数据;若后续需要系统级品牌,须通过迁移脚本写入。
*/
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addColumn('product_brands', 'is_system', {
type: Sequelize.TINYINT,
allowNull: false,
defaultValue: 0,
comment: '是否系统默认:1系统数据(不可改/删,全部主体可见) 0自定义(按主体隔离)',
});
},
async down(queryInterface) {
await queryInterface.removeColumn('product_brands', 'is_system');
},
};