跳到正文
Skillpedia
数据库25k · #10095

nocobase-app-plugin-database-explorer

它能做什么

这个技能说明如何在不做任何更改的情况下,查看 NocoBase 应用使用的数据库、数据表和字段。适合希望查看或分享该结构的管理员。

适用场景

  • ✓你想查看 NocoBase 应用连接了哪些数据库的时候。
  • ✓你需要查询 NocoBase 中某个数据集合的字段和列的时候。
  • ✓你希望系统管理员以外的角色也能查看数据库结构的时候。

技能链接

https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-database-explorer/skills/nocobase-app-plugin-database-explorer/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-database-explorer/skills/nocobase-app-plugin-database-explorer/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请显示我的 NocoBase 应用在主数据库中有哪些数据集合和字段。”

每周 5 个新技能,1 分钟读完。

工作原理

这个技能使用 Database Explorer 插件的四个只读接口,列出连接、数据集合及其字段。它没有写入接口,因此无法更改任何内容。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Database Explorer

Use this Skill when

Someone needs to see what databases an application talks to, which collections live on each one, or what fields and physical columns a collection has — and when a role other than System Administrator should be able to see that.

It is not for changing anything. The plugin has no write endpoint, and creating or altering a collection belongs to migrations.

Public surfaces

Four read endpoints:

Method and path Returns
GET /api/databaseExplorer/connections Every configured connection; the default one has isDefault: true
GET /api/databaseExplorer/connections/:connection/collections One page of collections; pageSize is 1–100 (default 20), pageToken opaque
GET /api/databaseExplorer/connections/:connection/collections/:collection The resolved definition, its fields, and resolution warnings
GET /api/databaseExplorer/connections/:connection/collections/:collection/physicalSchema Physical columns, indexes, keys, and constraints

Success is { data }; the connection list is { data, meta: { total } } and the collection list { data, meta: { nextPageToken? } }. Failures use the standard /api error body with domain databaseExplorer; branch on reason: DATABASE_EXPLORER_FORBIDDEN (403), CONNECTION_NOT_FOUND and COLLECTION_NOT_FOUND (404), INVALID_CURSOR and INVALID_LIST_OPTIONS (400), and DATABASE_UNAVAILABLE, CONNECTION_UNAVAILABLE, CONNECTION_UNREACHABLE and SCHEMA_READ_DENIED (503). A malformed pageSize or pageToken is 400 INVALID_INPUT in the app domain.

The running application documents these routes under the DatabaseExplorer tag at /api/swagger/docs (JSON at /api/swagger, signed in); their operationIds are databaseExplorerListConnections, databaseExplorerListCollections, databaseExplorerGetCollection and databaseExplorerGetPhysicalSchema.

The client entry exports DatabaseExplorerClient, a typed client for these endpoints, and DATABASE_EXPLORER_ACCESS, the grant they check. The plugin contributes no pages; an application that wants one builds it on the client and declares it among its own routes with that grant. The server entry also exports the read functions (listConnections, listCollections, readCollection, readPhysicalCollection), the DATABASE_EXPLORER_PAGE constant, and the response types.

Prerequisites

Register @nocobase/app-plugin-authentication and @nocobase/app-plugin-authorization before this plugin on both runtimes. An application configured with database.default: none gets 503 DATABASE_UNAVAILABLE from every endpoint.

App workflow

Add the plugin to both composition roots and to the application's dependencies:

// server/plugins.ts
import databaseExplorer from '@nocobase/app-plugin-database-explorer/server';

// client/plugins.ts
import databaseExplorer from '@nocobase/app-plugin-database-explorer/client';
// then call it: databaseExplorer()

A System Administrator can already read the endpoints, because that permission set grants page:*/access. To let another role in, add one grant to its permission set:

{
  "resource": { "type": "page", "id": "database-explorer" },
  "actions": [{ "action": "access" }]
}

An application page built on the endpoints declares its route with the same grant (DATABASE_EXPLORER_ACCESS), so the navigation entry and the endpoints never disagree.

Ownership

The plugin owns the access resource, its endpoints and their response shapes, and the rule about what a connection may reveal. Applications own whether the plugin is registered, any page built on it, and who is granted access.

Connection responses never carry a password, user name, host, port, socket path, SQLite filename, TLS material, driver options, or pool settings. That list is enforced as an allow-list in server/connection-summary.ts, so a field a new dialect adds stays inside by default. Do not turn it into a deny-list, and do not add a locator to it because a

常见问题

它会更改我的数据库吗?

不会。插件只读取信息,没有写入接口。

大列表如何分页?

数据集合列表支持 1 到 100 的每页条数,并使用页令牌获取下一页。

谁可以查看数据库结构?

系统管理员默认可以查看,你也可以向其他角色授予访问权限。

详情

作者的原始描述

Browse an application's database connections, collections, and fields read-only through the Database Explorer endpoints, and grant access to them.

repo: nocobase/nocobase

热度

GitHub 星标
25k
排名
#10095
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能