diff --git a/models/pbl_game_definition.json b/models/pbl_game_definition.json index f4228d9..46ee090 100644 --- a/models/pbl_game_definition.json +++ b/models/pbl_game_definition.json @@ -1,183 +1,218 @@ { - "summary": [ - { - "name": "pbl_game_definition", - "title": "Game Definition(第9章 schema + 指纹)", - "comment": "Game Definition(第9章 schema + 指纹)", - "primary": ["id"], - "catelog": "entity", - "module": "pbl_compiler", - "engine": "mariadb", - "charset": "utf8mb4", - "tenant_scoped": true - } - ], - "fields": [ - { - "name": "tenant_id", - "title": "租户ID(强制打头)", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "id", - "title": "主键ID", - "type": "str", - "length": 32, - "nullable": "no" - }, - { - "name": "blueprint_id", - "title": "来源蓝图", - "type": "str", - "length": 32, - "nullable": "no", - "default": "" - }, - { - "name": "blueprint_version_no", - "title": "蓝图版本", - "type": "int", - "nullable": "no", - "default": "1" - }, - { - "name": "compiler_version_id", - "title": "编译版本", - "type": "str", - "length": 32, - "nullable": "no", - "default": "" - }, - { - "name": "content_fingerprint", - "title": "SHA-256 指纹(64 位 hexdigest,唯一约束 uk_gd_fp 成员)", - "type": "str", - "length": 64, - "nullable": "no", - "default": "" - }, - { - "name": "definition_json", - "title": "Game Definition 正文", - "type": "text", - "nullable": "yes" - }, - { - "name": "world_id", - "title": "落库 world", - "type": "str", - "length": 32, - "nullable": "no", - "default": "" - }, - { - "name": "scene_id", - "title": "落库 scene", - "type": "str", - "length": 32, - "nullable": "no", - "default": "" - }, - { - "name": "entity_count", - "title": "实体数", - "type": "int", - "nullable": "yes", - "default": "0" - }, - { - "name": "event_count", - "title": "事件数", - "type": "int", - "nullable": "yes", - "default": "0" - }, - { - "name": "rules_json", - "title": "规则产物JSON(script_type=1规则数组,确定性序列化)", - "type": "text", - "nullable": "yes" - }, - { - "name": "rules_hash", - "title": "规则产物指纹(sha256,确定性)", - "type": "str", - "length": 64, - "nullable": "yes", - "default": "" - }, - { - "name": "rule_count", - "title": "规则条数", - "type": "int", - "nullable": "yes", - "default": "0" - }, - { - "name": "rules_manifest", - "title": "规则清单JSON(rule_id/event_type/content_hash)", - "type": "text", - "nullable": "yes" - }, - { - "name": "quality_state", - "title": "编译时质量状态", - "type": "str", - "length": 64, - "nullable": "yes", - "default": "" - }, - { - "name": "duration_ms", - "title": "耗时", - "type": "int", - "nullable": "yes", - "default": "0" - }, - { - "name": "created_by", - "title": "创建人", - "type": "str", - "length": 32, - "nullable": "yes", - "default": "" - }, - { - "name": "created_at", - "title": "创建时间", - "type": "datetime", - "nullable": "yes" - }, - { - "name": "updated_at", - "title": "更新时间", - "type": "datetime", - "nullable": "yes" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "idxtype": "unique", - "idxfields": ["id"] - }, - { - "name": "uk_gd_fp", - "idxtype": "unique", - "idxfields": ["tenant_id", "content_fingerprint"] - }, - { - "name": "idx_gd_bp", - "idxtype": "index", - "idxfields": ["tenant_id", "blueprint_id"] - }, - { - "name": "idx_gd_rules_hash", - "idxtype": "index", - "idxfields": ["tenant_id", "rules_hash"] - } - ], - "codes": [] + "summary": [ + { + "name": "pbl_game_definition", + "title": "Game Definition(第9章 schema + 指纹)", + "primary": ["id"], + "catelog": "entity" + } + ], + "fields": [ + { + "name": "id", + "title": "主键ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "tenant_id", + "title": "租户ID", + "type": "str", + "length": 32, + "nullable": "no", + "default": "0" + }, + { + "name": "blueprint_id", + "title": "蓝图ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "blueprint_version_no", + "title": "蓝图版本号", + "type": "int", + "nullable": "no", + "default": "0" + }, + { + "name": "compiler_version_id", + "title": "编译器版本ID", + "type": "str", + "length": 32, + "nullable": "no" + }, + { + "name": "content_fingerprint", + "title": "内容指纹(29.6 确定性:同输入必同值)", + "type": "str", + "length": 64, + "nullable": "no" + }, + { + "name": "definition_json", + "title": "Game Definition 正文(10 顶层键)", + "type": "text", + "nullable": "no" + }, + { + "name": "rules_json", + "title": "script_engine 规则映射产物(第12章 ECR→script_type=1,canonical JSON)", + "type": "text", + "nullable": "yes" + }, + { + "name": "rules_hash", + "title": "规则集合指纹(canonical_rules_json 的 sha256)", + "type": "str", + "length": 64, + "nullable": "yes" + }, + { + "name": "rule_count", + "title": "规则条数", + "type": "int", + "nullable": "yes", + "default": "0" + }, + { + "name": "rules_manifest", + "title": "规则溯源清单(ECR 来源→规则ID 映射,JSON)", + "type": "text", + "nullable": "yes" + }, + { + "name": "world_id", + "title": "世界ID", + "type": "str", + "length": 32, + "nullable": "yes" + }, + { + "name": "scene_id", + "title": "场景ID", + "type": "str", + "length": 32, + "nullable": "yes" + }, + { + "name": "compile_status", + "title": "编译结果状态", + "type": "str", + "length": 32, + "nullable": "yes", + "default": "pending" + }, + { + "name": "quality_state", + "title": "编译时质量状态", + "type": "str", + "length": 64, + "nullable": "yes" + }, + { + "name": "duration_ms", + "title": "编译耗时(毫秒)", + "type": "long", + "nullable": "yes", + "default": "0" + }, + { + "name": "error_message", + "title": "失败原因(编译/规则映射异常摘要)", + "type": "text", + "nullable": "yes" + }, + { + "name": "created_by", + "title": "创建人", + "type": "str", + "length": 32, + "nullable": "yes" + }, + { + "name": "created_at", + "title": "创建时间", + "type": "timestamp", + "nullable": "no" + }, + { + "name": "updated_by", + "title": "更新人", + "type": "str", + "length": 32, + "nullable": "yes" + }, + { + "name": "updated_at", + "title": "更新时间", + "type": "timestamp", + "nullable": "yes" + }, + { + "name": "is_deleted", + "title": "删除标记", + "type": "char", + "length": 1, + "nullable": "no", + "default": "0" + } + ], + "indexes": [ + { + "name": "PRIMARY", + "idxtype": "unique", + "idxfields": ["id"] + }, + { + "name": "uk_gd_fp", + "idxtype": "unique", + "idxfields": ["tenant_id", "content_fingerprint"] + }, + { + "name": "idx_gd_bp", + "idxtype": "index", + "idxfields": ["tenant_id", "blueprint_id", "blueprint_version_no"] + }, + { + "name": "idx_gd_rules_hash", + "idxtype": "index", + "idxfields": ["rules_hash"] + }, + { + "name": "idx_gd_quality_state", + "idxtype": "index", + "idxfields": ["quality_state"] + } + ], + "codes": [ + { + "field": "quality_state", + "table": "appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='pbl_quality_state'" + }, + { + "field": "compile_status", + "table": "appcodes_kv", + "valuefield": "k", + "textfield": "v", + "cond": "parentid='pbl_compile_status'" + }, + { + "field": "blueprint_id", + "table": "pbl_blueprint", + "valuefield": "id", + "textfield": "blueprint_name" + }, + { + "field": "compiler_version_id", + "table": "pbl_compiler_version", + "valuefield": "id", + "textfield": "version_name" + } + ] }