nocobase-db
하는 일
이 스킬은 NocoBase 3 앱의 데이터베이스 계층에서 AI를 안내합니다. 테이블, 마이그레이션, 데이터 로직을 추가하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓NocoBase 3 앱의 테이블이나 필드를 추가하거나 바꿔야 할 때.
- ✓레코드를 읽고 저장하며 트랜잭션이 필요한 코드를 쓸 때.
- ✓데이터베이스 연결을 설정하거나 마이그레이션이나 시드를 작성할 때.
스킬 링크
https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/db/skills/nocobase-db/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“마이그레이션을 사용해, 고객과 연결된 주문 테이블을 제 NocoBase 앱에 추가해 주실 수 있나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 작업에 맞는 계층, 즉 설정, 마이그레이션, 스키마 빌더, 런타임 저장소 중에서 고릅니다. 그다음 올바른 API와 트랜잭션 처리로 코드를 작성합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
The database in a NocoBase 3 application
Most mistakes here are made before the first line of code, by putting a task at the wrong layer: changing schema from runtime code, reading records through the schema builder, or reimplementing relation writes on top of raw queries.
Six areas, in the order an application grows into them:
| Area | Owns |
|---|---|
| Configuration | which databases exist, and which dialect each one speaks |
| Migrations and seeds | schema history and install data |
| Builder | how a migration declares tables, fields and constraints |
| Repository and Query | runtime reads and writes |
| Transactions | making several writes succeed or fail together |
| Collections | what the database actually resolves to, for code and for you |
The exact parameters and return types are always the TypeScript declarations in @nocobase/db. This Skill decides which API to reach for, where the code belongs, and the boundaries the types cannot express.
Where the code lives
server/config/database.ts connections and the default connection
config.yml per-environment overrides and credentials (gitignored)
database/<connection>/migrations schema history for that connection
database/<connection>/seeds install data for that connection
database/<connection>/collections resolved Collection artifacts
server/routes/, server/providers runtime reads and writes
<connection> is a connection name from server/config/database.ts, so the default connection's migrations are in database/main/migrations/. Adding a connection means adding its directory alongside and keeping database/tsconfig.json in place, so migrations and seeds are typechecked and linted as server source.
Runtime code never changes schema, and a migration never imports runtime code. That split is what these directories encode.
1. Configuration
Connections are declared in code and overridden per environment:
| Location | Responsibility |
|---|---|
server/config/database.ts |
Connection defaults through defineAppDatabaseConfig |
config.yml |
Environment overrides including credentials — gitignored |
config.example.yml |
The documented structure and credential placeholders; keep it in step |
import {
connectionEnvironment,
defineAppDatabaseConfig,
} from '@nocobase/app-server/database';
export default defineAppDatabaseConfig(
({ paths }) => ({
default: 'main',
connections: {
main: {
dialect: 'sqlite',
filename: paths.storage('database.sqlite'),
schemaManagement: 'managed',
debug: false,
},
},
}),
{ env: connectionEnvironment('main') },
);
The second argument maps environment variables onto the section: connectionEnvironment('main') declares DB_DIALECT, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, DB_SSL and DB_FILENAME for the main connection, each overriding config.yml. Only main has them; a connection you add declares its own with a prefix naming it, connectionEnvironment('analytics', 'DB_ANALYTICS'), merged into the same env.
The dialects are sqlite, postgres, mysql, mssql, oracle, dameng, kingbase and oceanbase. Each is an optional peer of @nocobase/app-server shipped as its own package: install @nocobase/db-<dialect> into dependencies — so it reaches the deployed server — and configure the dialect. No import or driver registration is needed, and the dialect package brings its own underlying driver.
Switching a dialect means changing both layers. config.yml deep-merges into the code defaults, so editing only the code leaves a stale YAML override in place — with fields belonging to the previous dialect still applied. Remove filename
자주 묻는 질문
일반 런타임 코드에서 테이블을 바꿀 수 있나요?
아니요. 이 스킬은 테이블 변경은 런타임 코드가 아니라 마이그레이션에 속한다고 밝힙니다.
NocoBase 2용인가요?
아니요. NocoBase 2는 다른 데이터베이스 패키지를 사용합니다.
시드란 무엇인가요?
시드는 앱이 시작하는 데 필요한 설치 데이터로 데이터베이스를 채우는 것입니다.
상세 정보
작성자의 원본 설명
Work with the database in a NocoBase 3 application: configure connections and dialects, add migrations and seeds, declare schema with the Collection Builder, read and write records with Repository or QueryAdapter, run transactions, and read Collection definitions. Use for any task under database/ or any server code that touches data. Do not use for the NocoBase 2 @nocobase/database package.
repo: nocobase/nocobase
인기도
- GitHub 스타
- 25k
- 순위
- #10083
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
nocobase-app-development
25k에이전트가 완전한 NocoBase 3 업무 애플리케이션을 위해 페이지, 라우트, 데이터, 권한, 테스트를 만들도록 돕습니다.
shadcn
25k에이전트가 웹 프로젝트에서 공식 문서와 레지스트리를 사용해 shadcn/ui 컴포넌트를 찾고, 추가하고, 고치고, 스타일을 입히도록 돕습니다.
nocobase-app-plugin-development
25k에이전트가 기존 NocoBase 3 앱 안에서 서버, 클라이언트, 데이터베이스, 등록 부분을 포함한 플러그인을 만들고 관리하도록 돕습니다.
nocobase-app-upgrade
25k에이전트가 NocoBase 앱을 더 새로운 템플릿 릴리스로 업그레이드하고, 사용자의 작업을 지키면서 템플릿 변경을 가져오도록 돕습니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.