---
title: 数据库 Entity 全景
created: 2026-04-13
updated: 2026-05-15
type: comparison
tags: [database, architecture, module]
sources: [packages/backend/src/entities.ts, packages/backend/src/modules/]
---

# 数据库 Entity 全景

全部 50+ 个 Entity 按模块分组对比，快速定位数据表。2026-05-14 后新增 [[desktop-op-module]] 的配置/审计表，并为 [[agent-channel]] 增加群白名单表。2026-05-15 后，[[netaclaw-module]] 增加 MySQL 问数数据源和查询审计表。

## 按模块分布

| 模块 | 表数量 | 核心表 |
|------|--------|--------|
| base | 11 | user, role, menu, department |
| netaclaw | 19 | agent, session, message, skill, model_channel, memory, memory_type, tool, subagent_session, crew, crew_agent, crew_run, crew_task, agent_channel, agent_channel_group, agent_session, agent_session_entry, data_source, data_source_query_audit |
| desktop_op | 2 | config, action_log |
| geo | 2 | account, proxy_ip |
| project | 5 | info, phase, task, task_dependency, time_log |
| data | 6 | drug_item, catalog, category, medical_item, medical_catalog, medical_category |
| user | 3 | info, wx, address |
| dict | 2 | type, info |
| task | 2 | info, log |
| space | 2 | info, type |
| notification | 2 | message_log, user |
| plugin | 1 | info |
| demo | 1 | goods |
| recycle | 1 | data |

## NetaClaw 核心表字段速查

### netaclaw_agent
`id` | `name`(唯一) | `label` | `description` | `icon` | `systemPrompt` | `skills`(JSON数组) | `toolsets`(JSON数组) | `tools`(JSON: inheritCoreTools/enabled/disabled) | `subagentConfig`(JSON) | `modelConfig`(JSON) | `config`(JSON) | `auxiliaryModelChannelId` | `auxiliaryModelId` | `compactionThreshold` | `compactionKeepRecent` | `status`

### netaclaw_session
`id` | `sessionId`(唯一) | `userId` | `agentName` | `agentId` | `title` | `model` | `status` | `metadata`

### netaclaw_message
`id` | `sessionId` | `role`(user/assistant/tool/system) | `content` | `thinking` | `toolCalls`(JSON) | `toolCallId` | `skillName` | `metadata` | `compactedAt` | `compactedIntoId` | `isCompactionSummary`

### netaclaw_skill
`id` | `name`(唯一) | `label` | `description` | `skillType` | `tags`(JSON) | `status` | `version` | `source` | `sourceUrl` | `installSpec`(JSON) | `metadata`(JSON) | `fingerprint` | `installedAt` | `secrets`(AES-256-GCM密文) | `envSchema`(JSON)

### netaclaw_model_channel
`id` | `name`(唯一) | `supplier` | `baseUrl` | `apiKey` | `models`(JSON) | `description` | `isAuxiliary` | `status`

### netaclaw_memory
`id` | `agentName` | `userId` | `type`(user/project/feedback/reference/自定义) | `name` | `content` | `description` | `metadata`

### netaclaw_memory_type
`id` | `key`(唯一) | `name` | `description` | `icon` | `isSystem`

### netaclaw_tool
`id` | `name`(唯一) | `label` | `toolset` | `description` | `visibility` | `capability` | `status` | `isCore` | `canDisable` | `supportsPromptHint` | `promptHint` | `sort` | `extra`

### netaclaw_subagent_session
`id` | `sessionId` | `parentMessageId` | `parentToolCallId` | `parentAgentId` | `sourceType` | `presetAgentId` | `name` | `goal` | `context` | `status` | `model` | `toolNames`(JSON) | `summary` | `resultPayload`(JSON) | `error` | `tokenUsage`(JSON) | `sortOrder` | `startedAt` | `endedAt`

### netaclaw_crew
`id` | `name`(唯一) | `label` | `masterAgentId` | `canvasData`(JSON) | `triggerConfig`(JSON) | `delegateHints` | `status` | `maxConcurrent` | `taskTimeout` | `retryPolicy`(JSON)

### netaclaw_crew_agent
`id` | `crewId` | `agentId` | `role` | `canvasPosition`(JSON) | `groupName`

### netaclaw_crew_run
`id` | `crewId` | `triggerType` | `triggerInput`(JSON) | `status` | `masterSessionId` | `startTime` | `endTime` | `result`(JSON) | `error` | `pausedState`(JSON) | `tokenUsage`(JSON)

### netaclaw_crew_task
`id` | `runId` | `agentId` | `taskDescription` | `status` | `sessionId` | `startTime` | `endTime` | `result` | `error` | `retryCount` | `timeout` | `tokenUsage`(JSON) | `parentTaskId`

### netaclaw_agent_channel
`id` | `name`(唯一) | `type`(weixin/weixin-db) | `agentId` | `agentName` | `config`(JSON,含 group/weixinReply) | `credential`(JSON,含 wxid/wechatVersion) | `runtime`(JSON) | `loginStatus` | `lastError` | `lastConnectedAt`

### netaclaw_agent_channel_group
`id` | `channelId` | `roomId`(channel内唯一) | `roomName` | `status` | `triggerMode` | `triggerPrefix` | `boundAgentId`(weixin-db 群级必填) | `replyIdentityOverride`(weixin-db 群级必填) | `firstSeenAt` | `lastSeenAt` | `lastActiveAt`

### netaclaw_data_source
`id` | `name`(唯一) | `label` | `type`(mysql) | `host` | `port` | `database` | `username` | `passwordEncrypted`(AES-256-GCM密文) | `readonly` | `status` | `allowedAgentIds`(JSON) | `extra`(JSON: allowedTables/blockedTables/maskedColumns/schemaVisibility/maxRows/maxJoinTables/queryTimeoutMs/connectTimeout/poolConnectionLimit/SSL)

### netaclaw_data_source_query_audit
`id` | `dataSourceId` | `agentId` | `userId` | `toolCallId` | `sqlHash` | `sqlPreview` | `status`(success/rejected/failed) | `rejectReason` | `elapsedMs` | `rowCount` | `errorCode`

## Desktop Op 核心表字段速查

### desktop_op_config
`id` | `allowedApps`(JSON) | `extraDangerousKeys`(JSON) | `globalPerMin` | `globalPerDay` | `defaultWatermark`

### desktop_op_action_log
`id` | `taskId` | `appId` | `targetJson` | `actionType` | `paramsPreview` | `finalText` | `channelId` | `roomName` | `modelChannelId` | `modelCalls` | `steps` | `durationMs` | `status` | `error` | `abortedReason`

## Geo 核心表字段速查

### geo_account
`id` | `name` | `platform` | `loginAccount` | `sessionName`(唯一) | `agentId` | `fingerprintSeed` | `cookies` | `cookieCapturedAt` | `cookieExpiresAt` | `loginStatus` | `proxyId` | `lastActiveAt` | `extra`

### geo_proxy_ip
`id` | `name` | `provider` | `mode` | `host` | `port` | `protocol` | `username` | `password` | `region` | `isp` | `exitIp` | `city` | `packageId` | `externalId` | `bindAccountId`(唯一) | `status` | `latencyMs` | `lastCheckAt` | `expiresAt` | `extra`

## 通用字段（BaseEntity）

所有表继承：`id` | `createTime` | `updateTime` | `tenantId`

## 相关页面

- [[netaclaw-module]] — NetaClaw 19 个核心表
- [[mysql-data-source]] — netaclaw_data_source 与 netaclaw_data_source_query_audit
- [[memory-system]] — netaclaw_memory 与 netaclaw_memory_type
- [[tool-governance]] — netaclaw_tool 治理表
- [[skill-runtime]] — netaclaw_skill 的 secrets 与 envSchema
- [[subagent-session]] — netaclaw_subagent_session 运行记录
- [[context-compaction]] — netaclaw_message 的压缩字段
- [[crew-orchestration]] — Crew 编排 4 个表
- [[agent-channel]] — 渠道配置表
- [[desktop-op-module]] — desktop_op_config 与 desktop_op_action_log
- [[geo-module]] — geo_account 与 geo_proxy_ip
- [[base-module]] — Base 11 个系统表
- [[project-module]] — Project 5 个业务表
- [[cool-admin-framework]] — BaseEntity 和自动 CRUD
