मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)25k · #10083

nocobase-db

यह क्या करती है

यह स्किल NocoBase 3 ऐप की डेटाबेस परत में आपके AI का मार्गदर्शन करती है। यह उन डेवलपर्स के लिए है जो ऐप में टेबल, माइग्रेशन या डेटा लॉजिक जोड़ते हैं।

कब इस्तेमाल करें

  • ✓जब आपको NocoBase 3 ऐप में कोई टेबल या फ़ील्ड जोड़ना या बदलना हो।
  • ✓जब आप ऐसा कोड लिखें जो रिकॉर्ड पढ़ता या सेव करता है और जिसमें ट्रांज़ैक्शन चाहिए।
  • ✓जब आप डेटाबेस कनेक्शन सेट करें या माइग्रेशन या सीड लिखें।

Skill का लिंक

https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/db/skills/nocobase-db/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/nocobase/nocobase/blob/v3-develop/packages/libs/db/skills/nocobase-db/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप मेरे NocoBase ऐप में माइग्रेशन का उपयोग करके एक orders टेबल जोड़ सकते हैं, जो customers से जुड़ी हो?”

हर हफ़्ते 5 नई skills, 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
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

nocobase-app-development

25k

यह आपके एजेंट को पूर्ण NocoBase 3 व्यावसायिक एप्लिकेशन के लिए पेज, routes, डेटा, अनुमतियाँ और टेस्ट बनाने में मदद करती है।

कोडिंगसामान्य कोडिंग

shadcn

25k

यह आपके एजेंट को वेब प्रोजेक्ट में shadcn/ui कंपोनेंट खोजने, जोड़ने, ठीक करने और स्टाइल करने में मदद करती है, उनके आधिकारिक दस्तावेज़ और registries का उपयोग करके।

कोडिंगवेबसाइट और UI (frontend)

nocobase-app-plugin-development

25k

यह आपके एजेंट को मौजूदा NocoBase 3 ऐप के भीतर plugins बनाने और उनकी देखभाल करने में मदद करती है, जिसमें server, client, database और registration के हिस्से शामिल हैं।

कोडिंगAPI और सर्वर (backend)

nocobase-app-upgrade

25k

यह आपके एजेंट को NocoBase ऐप को नए template रिलीज़ तक अपग्रेड करने में मदद करती है, template के बदलाव लाते हुए आपका अपना काम बनाए रखते हुए।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

मिलती-जुलती skills