pbl_domain_ext/models/pbl_entity_ref.json
2026-09-18 00:05:05 +08:00

31 lines
2.6 KiB
JSON
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.

{
"summary": "PBL 实体关联表(薄扩展):把基表 entity 绑定到 PBL 租户/班级/团队 + scene/world 父级归属,不改 entity 基表结构Q-OPEN-3",
"tblname": "pbl_entity_ref",
"fields": [
{"name": "id", "type": "bigint", "primary": true, "auto": true, "comment": "主键"},
{"name": "tenant_id", "type": "varchar(64)", "null": false, "comment": "PBL 租户ID强制打头"},
{"name": "entity_id", "type": "bigint", "null": false, "comment": "基表 entity.id只读引用不建外键"},
{"name": "scene_id", "type": "bigint", "null": false, "default": 0, "comment": "父级归属 scene.id0=未指定"},
{"name": "world_id", "type": "bigint", "null": false, "default": 0, "comment": "父级归属 world.id0=未指定"},
{"name": "class_id", "type": "bigint", "null": false, "default": 0, "comment": "归属班级 pbl_class.id"},
{"name": "team_id", "type": "bigint", "null": false, "default": 0, "comment": "归属团队 pbl_team.id"},
{"name": "visibility", "type": "varchar(16)", "null": false, "default": "team", "comment": "可见性 team/class/tenant"},
{"name": "role_code", "type": "varchar(64)", "null": false, "default": "", "comment": "角色绑定(该实体扮演的蓝图角色),空=通用"},
{"name": "source", "type": "varchar(32)", "null": false, "default": "manual", "comment": "来源 manual/compiler/import"},
{"name": "ext_json", "type": "text", "null": true, "comment": "PBL 侧扩展属性 JSON实体在 PBL 语义下的额外属性,不回写基表)"},
{"name": "created_by", "type": "varchar(64)", "null": true, "comment": "创建人"},
{"name": "created_at", "type": "datetime", "null": false, "default": "CURRENT_TIMESTAMP", "comment": "创建时间"},
{"name": "updated_at", "type": "datetime", "null": true, "comment": "更新时间"}
],
"indexes": [
{"name": "uk_pbl_entity_ref", "unique": true, "fields": ["tenant_id", "entity_id", "team_id", "role_code"], "comment": "幂等唯一键"},
{"name": "idx_pbl_entity_ref_scene", "unique": false, "fields": ["tenant_id", "scene_id"], "comment": "按场景查实体"},
{"name": "idx_pbl_entity_ref_world", "unique": false, "fields": ["tenant_id", "world_id"], "comment": "按世界查实体"},
{"name": "idx_pbl_entity_ref_team", "unique": false, "fields": ["tenant_id", "team_id"], "comment": "按团队查"}
],
"codes": {
"visibility": {"team": "团队可见", "class": "班级可见", "tenant": "租户可见"},
"source": {"manual": "人工绑定", "compiler": "Compiler 物化", "import": "批量导入"}
}
}