@nocobase/plugin-ai 2.3.0-alpha.1 → 3.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/docs/nocobase/ai-employees/block/ai-chat-box.md +133 -0
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
- package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
- package/dist/ai/docs/nocobase/api/app/env.md +3 -1
- package/dist/ai/docs/nocobase/api/cli/index.md +14 -2
- package/dist/ai/docs/nocobase/api/cli/portal/config.md +44 -0
- package/dist/ai/docs/nocobase/api/cli/portal/create.md +48 -0
- package/dist/ai/docs/nocobase/api/cli/portal/deploy.md +39 -0
- package/dist/ai/docs/nocobase/api/cli/portal/destroy.md +41 -0
- package/dist/ai/docs/nocobase/api/cli/portal/dev.md +39 -0
- package/dist/ai/docs/nocobase/api/cli/portal/index.md +136 -0
- package/dist/ai/docs/nocobase/api/cli/portal/info.md +41 -0
- package/dist/ai/docs/nocobase/api/cli/portal/list.md +40 -0
- package/dist/ai/docs/nocobase/api/cli/portal/pull.md +43 -0
- package/dist/ai/docs/nocobase/api/cli/portal/push.md +41 -0
- package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
- package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
- package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
- package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
- package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
- package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
- package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
- package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
- package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
- package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
- package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
- package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
- package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
- package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
- package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
- package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
- package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
- package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
- package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
- package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
- package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
- package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
- package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
- package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
- package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
- package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
- package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
- package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
- package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
- package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
- package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
- package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
- package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
- package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
- package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
- package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
- package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
- package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
- package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
- package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
- package/dist/ai/docs/nocobase/file-manager/storage/index.md +66 -26
- package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
- package/dist/ai/docs/nocobase/get-started/installation/env.md +2 -2
- package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
- package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
- package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
- package/dist/ai/tools/executeFrontendTool.js +86 -0
- package/dist/ai/tools/getSkill.js +1 -1
- package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
- package/dist/ai/tools/loadFrontendTool.js +99 -0
- package/dist/client/244.8631eb5cf3f05e21.js +10 -0
- package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
- package/dist/client/681.6ffbc9329b9ac242.js +10 -0
- package/dist/{client-v2/705.1d10027ff8cfdf79.js → client/705.19b642db34de438a.js} +1 -1
- package/dist/client/index.d.ts +1 -3
- package/dist/client/index.js +8 -8
- package/dist/client-v2/244.c428e645ecb94414.js +10 -0
- package/dist/client-v2/420.b2aedb1ff71fca0e.js +10 -0
- package/dist/client-v2/681.6890caa389564ff7.js +10 -0
- package/dist/client-v2/705.8dc34d43f02f322c.js +10 -0
- package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
- package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
- package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
- package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
- package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
- package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
- package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
- package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
- package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
- package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
- package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
- package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
- package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
- package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
- package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -31
- package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
- package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
- package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
- package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
- package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
- package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
- package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
- package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
- package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
- package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
- package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
- package/dist/client-v2/ai-employees/types.d.ts +30 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
- package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxCoreView.d.ts +10 -0
- package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
- package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
- package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
- package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
- package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
- package/dist/client-v2/index.d.ts +3 -5
- package/dist/client-v2/index.js +3 -3
- package/dist/client-v2/llm-services/model-select.d.ts +33 -0
- package/dist/client-v2/llm-services/utils.d.ts +1 -0
- package/dist/client-v2/manager/ai-manager.d.ts +10 -3
- package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
- package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
- package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +5 -0
- package/dist/client-v2/pages/EmployeesPage.d.ts +2 -0
- package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
- package/dist/common/ai-employee-validation.d.ts +15 -0
- package/dist/common/ai-employee-validation.js +61 -0
- package/dist/common/error-codes.d.ts +13 -0
- package/dist/common/error-codes.js +48 -0
- package/dist/common/frontend-tools.d.ts +26 -0
- package/dist/common/frontend-tools.js +57 -0
- package/dist/common/llm-service-models.d.ts +16 -0
- package/dist/common/llm-service-models.js +84 -0
- package/dist/externalVersion.js +16 -16
- package/dist/locale/en-US.json +67 -0
- package/dist/locale/zh-CN.json +67 -0
- package/dist/node_modules/@langchain/mistralai/package.json +1 -1
- package/dist/node_modules/@langchain/xai/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonrepair/package.json +1 -1
- package/dist/node_modules/just-bash/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/node_modules/openai/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/ai-employees/ai-conversations.d.ts +4 -1
- package/dist/server/ai-employees/ai-conversations.js +2 -0
- package/dist/server/ai-employees/ai-employee.d.ts +2 -1
- package/dist/server/ai-employees/ai-employee.js +26 -7
- package/dist/server/ai-employees/middleware/conversation.js +9 -2
- package/dist/server/collections/ai-conversations.js +5 -0
- package/dist/server/document-loader/constants.js +1 -1
- package/dist/server/frontend-tools.d.ts +25 -0
- package/dist/server/frontend-tools.js +171 -0
- package/dist/server/manager/work-context-handler.js +10 -3
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +25 -0
- package/dist/server/resource/aiConversations.d.ts +2 -0
- package/dist/server/resource/aiConversations.js +33 -3
- package/dist/server/resource/aiEmployees.d.ts +2 -0
- package/dist/server/resource/aiEmployees.js +62 -0
- package/dist/server/resource/aiWorkflowTasks.js +9 -1
- package/dist/server/resource/llmServices.d.ts +11 -0
- package/dist/server/resource/llmServices.js +85 -0
- package/dist/server/types/knowledge-base.type.d.ts +6 -2
- package/dist/swagger/common.d.ts +143 -0
- package/dist/swagger/common.js +144 -0
- package/dist/swagger/employees.d.ts +301 -0
- package/dist/swagger/employees.js +131 -0
- package/dist/swagger/index.d.ts +1588 -0
- package/dist/swagger/index.js +62 -0
- package/dist/swagger/llm.d.ts +555 -0
- package/dist/swagger/llm.js +247 -0
- package/dist/swagger/schemas.d.ts +736 -0
- package/dist/swagger/schemas.js +381 -0
- package/package.json +2 -2
- package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
- package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
- package/dist/client/372.40eb52905e3f3049.js +0 -10
- package/dist/client/681.399948c18d753667.js +0 -10
- package/dist/client/705.380279da896021fb.js +0 -10
- package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
- package/dist/client-v2/406.341be51205c674e0.js +0 -10
- package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
- package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
- package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
|
@@ -1,118 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
---
|
|
2
|
+
title: "Field validation"
|
|
3
|
+
description: "Field validation rules based on Joi configuration and validation rules. Supports minimum and maximum length, required values, and other rules for string, number, date, and other types."
|
|
4
|
+
keywords: "field validation,field validation rules,Joi,validation rules,configuration rules,NocoBase"
|
|
5
|
+
---
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
# Field validation
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
To ensure collection accuracy, security, and consistency, NocoBase provides field validation. It has two parts: configuration rules and validation rules.
|
|
7
10
|
|
|
11
|
+
## Configuration rules
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+

|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
NocoBase field rules integrate [Joi](https://joi.dev/api/). The supported rules are as follows.
|
|
16
|
+
|
|
17
|
+
### String types
|
|
18
|
+
|
|
19
|
+
NocoBase Field interfaces corresponding to Joi string types include Input, Textarea, Phone, Email, URL, Password, and UUID.
|
|
20
|
+
|
|
21
|
+
#### Common rules
|
|
22
|
+
|
|
23
|
+
- Minimum length
|
|
24
|
+
- Maximum length
|
|
16
25
|
- Length
|
|
17
|
-
-
|
|
26
|
+
- Regular expression
|
|
18
27
|
- Required
|
|
19
28
|
|
|
20
29
|
#### Email
|
|
21
30
|
|
|
22
|
-

|
|
23
32
|
|
|
24
33
|
[View more options](https://joi.dev/api/?v=17.13.3#stringemailoptions)
|
|
25
34
|
|
|
26
35
|
#### URL
|
|
27
36
|
|
|
28
|
-

|
|
29
38
|
|
|
30
39
|
[View more options](https://joi.dev/api/?v=17.13.3#stringurioptions)
|
|
31
40
|
|
|
32
41
|
#### UUID
|
|
33
42
|
|
|
34
|
-

|
|
35
44
|
|
|
36
45
|
[View more options](https://joi.dev/api/?v=17.13.3#stringguid---aliases-uuid)
|
|
37
46
|
|
|
38
|
-
### Number
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
### Number types
|
|
48
|
+
|
|
49
|
+
NocoBase Field interfaces corresponding to Joi number types include Integer, Number, and Percent.
|
|
50
|
+
|
|
51
|
+
#### Common rules
|
|
52
|
+
|
|
41
53
|
- Greater than
|
|
42
54
|
- Less than
|
|
43
|
-
-
|
|
44
|
-
-
|
|
55
|
+
- Maximum value
|
|
56
|
+
- Minimum value
|
|
45
57
|
- Multiple
|
|
46
58
|
|
|
47
59
|
#### Integer
|
|
48
|
-
In addition to common rules, integer fields additionally support [integer validation](https://joi.dev/api/?v=17.13.3#numberinteger) and [unsafe integer validation](https://joi.dev/api/?v=17.13.3#numberunsafeenabled).
|
|
49
60
|
|
|
50
|
-
|
|
61
|
+
In addition to common rules, Integer fields support [integer validation](https://joi.dev/api/?v=17.13.3#numberinteger) and [unsafe-integer validation](https://joi.dev/api/?v=17.13.3#numberunsafeenabled).
|
|
51
62
|
|
|
63
|
+

|
|
52
64
|
|
|
53
|
-
#### Number
|
|
54
|
-
In addition to common rules, number and percentage fields additionally support [precision validation](https://joi.dev/api/?v=17.13.3#numberinteger).
|
|
65
|
+
#### Number and Percent
|
|
55
66
|
|
|
56
|
-
|
|
67
|
+
In addition to common rules, Number and Percent fields support [precision validation](https://joi.dev/api/?v=17.13.3#numberinteger).
|
|
57
68
|
|
|
69
|
+

|
|
58
70
|
|
|
59
|
-
### Date
|
|
60
|
-
|
|
71
|
+
### Date types
|
|
72
|
+
|
|
73
|
+
NocoBase Field interfaces corresponding to Joi date types include DateTime (with time zone), DateTime (without time zone), Date only, and Unix timestamp.
|
|
74
|
+
|
|
75
|
+
Supported validation rules are:
|
|
61
76
|
|
|
62
|
-
Supported validation rules:
|
|
63
77
|
- Greater than
|
|
64
78
|
- Less than
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
- Timestamp
|
|
79
|
+
- Maximum value
|
|
80
|
+
- Minimum value
|
|
81
|
+
- Timestamp format validation
|
|
68
82
|
- Required
|
|
69
83
|
|
|
70
|
-
###
|
|
71
|
-
Association fields only support required validation. Note that required validation for association fields is currently not supported in sub-form or sub-table scenarios.
|
|
72
|
-
|
|
73
|
-

|
|
84
|
+
### Relation fields
|
|
74
85
|
|
|
86
|
+
Relation fields support required validation only. Note that required validation for relation fields is not currently supported in Subform or Subtable scenarios.
|
|
75
87
|
|
|
76
|
-
|
|
77
|
-
After configuring field rules, the corresponding validation rules will be triggered when adding or modifying data.
|
|
88
|
+

|
|
78
89
|
|
|
79
|
-
|
|
90
|
+
## Apply validation rules
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
After you configure field rules, the corresponding validation rules are triggered when data is created or changed.
|
|
82
93
|
|
|
83
|
-
|
|
94
|
+

|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
When a field is used in a form, its validation rules also appear in the field validation settings. They are displayed as read-only under **Server-side field validation rules**. To change these rules, return to **Data source / Collection configuration** and edit the field.
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
You can still add additional rules for the current form field under **Client-side validation rules**. These rules affect only the current field component. The validation rules that ultimately take effect combine **Server-side field validation rules** and **Client-side validation rules**.
|
|
88
99
|
|
|
100
|
+
Validation rules also apply to Subtable and Subform components:
|
|
89
101
|
|
|
102
|
+

|
|
90
103
|
|
|
91
|
-

|
|
92
105
|
|
|
106
|
+
Note that required validation for relation fields does not take effect in Subform or Subtable scenarios.
|
|
93
107
|
|
|
94
|
-
|
|
108
|
+

|
|
95
109
|
|
|
96
|
-
|
|
110
|
+
## Difference between server-side field validation rules and client-side validation rules
|
|
97
111
|
|
|
98
|
-
|
|
99
|
-
## Differences Between Server-Side Field Validation Rules and Client-Side Validation Rules
|
|
100
112
|
Server-side field validation rules and client-side validation rules are configured in different places and have different scopes.
|
|
101
113
|
|
|
102
|
-
### Configuration
|
|
103
|
-
- **Server-side field validation rules**: Set field rules in Data source → Collection configuration. These rules are the base rules of the field.
|
|
104
|
-
- **Client-side validation rules**: Configure extra rules in a form field's settings. These rules only affect the current field component.
|
|
105
|
-
|
|
106
|
-

|
|
107
|
-
|
|
114
|
+
### Configuration differences
|
|
108
115
|
|
|
116
|
+
- **Server-side field validation rules**: Set field rules in **Data source / Collection configuration**. These rules are the base rules of the field
|
|
117
|
+
- **Client-side validation rules**: Add additional rules in form-field settings. These rules affect only the current field component
|
|
109
118
|
|
|
110
|
-

|
|
111
120
|
|
|
121
|
+

|
|
112
122
|
|
|
123
|
+
### Validation timing differences
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
- **
|
|
116
|
-
- **
|
|
117
|
-
- **
|
|
118
|
-
- **Error messages**: Client-side validation rules support custom error messages, while server-side field validation rules do not currently support custom error messages.
|
|
125
|
+
- **Server-side field validation rules**: Trigger client-side validation when the field is used in a form, and trigger validation before data is written. These rules also apply when data is created or changed through workflows, data import, and other paths
|
|
126
|
+
- **Client-side validation rules**: Trigger client-side validation only in the current form field
|
|
127
|
+
- **Rule display**: Server-side field validation rules are displayed read-only as inherited rules. Client-side validation rules are displayed separately and can be edited here
|
|
128
|
+
- **Error messages**: Client-side validation rules support custom error messages. Server-side field validation rules do not currently support custom error messages
|
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: "Collections"
|
|
3
|
+
description: "Learn the purpose of NocoBase collections, collection structure types, the difference between main and external collections, and how to choose general, inheritance, tree, file, SQL, and database-view collections."
|
|
4
|
+
keywords: "collection,general collection,inheritance collection,tree collection,file collection,SQL collection,database view,NocoBase"
|
|
5
|
+
---
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
# Collections
|
|
4
8
|
|
|
9
|
+
## Introduction
|
|
5
10
|
|
|
6
|
-
|
|
11
|
+
In NocoBase, a **Collection** is the data model used to describe one category of business data. It is more than a database table name: it is NocoBase's unified description of a category of data.
|
|
7
12
|
|
|
13
|
+
A collection usually defines three things:
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
| Definition | Description |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| Where data is stored | Data can come from a main-database table, external-database table, SQL query result, database view, REST API resource, or external NocoBase application. |
|
|
18
|
+
| Which fields it has | Fields describe the information in each record, such as a customer name, mobile number, order amount, creation time, or owner. |
|
|
19
|
+
| How NocoBase uses it | Blocks, permissions, workflows, APIs, and relation fields all work with collections. |
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
You can think of a collection as the data structure for a business object. For example, **Customers**, **Orders**, **Contracts**, and **Tasks** can each be a collection.
|
|
22
|
+
|
|
23
|
+
After you create or connect a collection, you usually need to do three more things:
|
|
24
|
+
|
|
25
|
+
- Configure fields so that the collection can store the required business information
|
|
26
|
+
- [Add blocks](../../interface-builder/blocks/index.md#add-blocks) to pages so that users can view, enter, and process data
|
|
27
|
+
- Configure permissions, workflows, and APIs so that data can be accessed and processed according to business rules
|
|
28
|
+
|
|
29
|
+
## Collection structure types
|
|
30
|
+
|
|
31
|
+
- **General collection** - Suitable for standard business data such as customers, orders, contracts, work orders, expense claims, projects, and tasks
|
|
32
|
+
- **Tree collection** - Suitable for hierarchical data such as organizational structures, product categories, regional hierarchies, department directories, and knowledge-base directories
|
|
33
|
+
- **Calendar collection** - Suitable for time-range data such as meeting-room reservations, project schedules, course schedules, duty rosters, and event calendars
|
|
34
|
+
- **Comment collection** - Suitable for discussion content around business records, such as task comments, article comments, approval opinions, and customer feedback. Create a [relation field](./collection-fields/associations/index.md) in a business collection (general, tree, or calendar) to relate it to a comment collection, then add a [comment block](../../plugins/@nocobase/plugin-comments/index.md) in a business-collection popup page to comment on business data
|
|
35
|
+
- **File collection** - Suitable for file metadata such as contract attachments, invoice files, product images, and employee certificates. The files themselves are stored by the file-storage engine. Create a [relation field](./collection-fields/associations/index.md) in a business collection (general, tree, or calendar) to relate it to a file collection, then configure the relation field for file upload in a business-collection block. File metadata is automatically saved to the file collection
|
|
36
|
+
- **Database view** - An existing database view, such as a financial-report view, filtered customer view, or aggregated view synchronized across systems
|
|
37
|
+
- **SQL collection** - Suitable for using SQL query results as collections, such as sales summaries, inventory alerts, cross-table statistical reports, and operational dashboards
|
|
38
|
+
- **Inheritance collection** - Suitable when several business objects share a group of common fields but each also has its own fields, such as an asset parent collection that has computer-asset, vehicle-asset, and office-furniture child collections
|
|
@@ -1,53 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Data modeling overview"
|
|
3
|
+
description: "Data modeling covers designing data models, connecting data sources, visualizing ER diagrams, and creating collections for main and external databases."
|
|
4
|
+
keywords: "data modeling,Collection,data model,ER diagram,main database,external database,NocoBase"
|
|
5
|
+
---
|
|
6
|
+
|
|
1
7
|
# Overview
|
|
2
8
|
|
|
3
|
-
Data modeling is a key step in
|
|
9
|
+
Data modeling is a key step in database design. It involves analyzing and abstracting real-world data and the relationships between it. This process reveals the internal connections between data and formalizes them as a data model, providing the foundation for an information system's database structure. NocoBase is a data-model-driven platform with the following capabilities.
|
|
4
10
|
|
|
5
|
-
##
|
|
11
|
+
## Connect data from many sources
|
|
6
12
|
|
|
7
|
-
NocoBase
|
|
13
|
+
NocoBase data sources can be common databases, API (SDK) platforms, and files.
|
|
8
14
|
|
|
9
|
-

|
|
10
16
|
|
|
11
|
-
NocoBase provides
|
|
17
|
+
NocoBase provides the [Data source management plugin](../data-source-manager/index.md) to manage data sources and their collections. It provides the management interface for all data sources, but does not connect a data source by itself; use it with the corresponding data-source plugins. Supported data sources include:
|
|
12
18
|
|
|
13
|
-
- [Main
|
|
14
|
-
- [KingbaseES](/
|
|
15
|
-
- [External MySQL](/
|
|
16
|
-
- [External MariaDB](/
|
|
17
|
-
- [External PostgreSQL](/
|
|
18
|
-
- [External MSSQL](/
|
|
19
|
-
- [External Oracle](/
|
|
19
|
+
- [Main data source](../main/index.md): The NocoBase main database. It supports relational databases such as MySQL, PostgreSQL, and MariaDB
|
|
20
|
+
- [KingbaseES](../main/kingbase.md): Uses KingbaseES as a data source. It can be used as a main or external database
|
|
21
|
+
- [External MySQL](../external/mysql.md): Uses an external MySQL database as a data source
|
|
22
|
+
- [External MariaDB](../external/mariadb.md): Uses an external MariaDB database as a data source
|
|
23
|
+
- [External PostgreSQL](../external/postgresql.md): Uses an external PostgreSQL database as a data source
|
|
24
|
+
- [External MSSQL](../external/mssql.md): Uses an external MSSQL (SQL Server) database as a data source
|
|
25
|
+
- [External Oracle](../external/oracle.md): Uses an external Oracle database as a data source
|
|
20
26
|
|
|
21
|
-

|
|
22
28
|
|
|
23
|
-
##
|
|
29
|
+
## Data-modeling tools
|
|
24
30
|
|
|
25
|
-
**
|
|
31
|
+
**A simple collection management interface**: Create different models (collections) or connect existing models (collections).
|
|
26
32
|
|
|
27
|
-

|
|
28
34
|
|
|
29
|
-
**ER-
|
|
35
|
+
**An ER-diagram-like visual interface**: Extract entities and their relationships from user and business needs. It provides an intuitive way to describe data models so that you can understand the main data entities in the system and their connections more clearly.
|
|
30
36
|
|
|
31
|
-

|
|
32
38
|
|
|
33
|
-
##
|
|
39
|
+
## Create different collection types
|
|
34
40
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
| Collection | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| [General collection](../data-source-main/general-collection.md) | Includes common system fields. |
|
|
44
|
+
| [Calendar collection](../calendar/calendar-collection.md) | Creates event collections for calendar-related data. |
|
|
45
|
+
| Comment collection | Stores comments or feedback about data. |
|
|
46
|
+
| [Tree collection](../collection-tree/index.md) | A hierarchical collection that currently supports the adjacency-list model only. |
|
|
47
|
+
| [File collection](../file-manager/file-collection.md) | Manages file storage. |
|
|
48
|
+
| [SQL collection](../collection-sql/index.md) | Does not create an actual database table. It presents SQL query results in a structured way. |
|
|
49
|
+
| [Connect a database view](../collection-view/index.md) | Connects an existing database view. |
|
|
50
|
+
| Expression collection | Used for dynamic expression scenarios in workflows. |
|
|
51
|
+
| Connect external data | Connects remote data tables through database FDW technology. |
|
|
44
52
|
|
|
45
|
-

|
|
46
54
|
|
|
47
|
-
For more
|
|
55
|
+
For more information, see [Collections](./collection.md).
|
|
48
56
|
|
|
49
|
-
##
|
|
57
|
+
## Rich field types
|
|
50
58
|
|
|
51
|
-

|
|
52
60
|
|
|
53
|
-
For more
|
|
61
|
+
For more information, see [Fields](./collection-fields/index.md).
|
|
@@ -1,18 +1,126 @@
|
|
|
1
1
|
---
|
|
2
2
|
pkg: "@nocobase/plugin-data-source-external-mariadb"
|
|
3
|
+
title: "External data source - MariaDB"
|
|
4
|
+
description: "Learn how to connect MariaDB as an external database in NocoBase, including supported versions, plugin installation, connection settings, collection scope, permissions, and field mapping."
|
|
5
|
+
keywords: "external data source,MariaDB,external database,field mapping,NocoBase"
|
|
3
6
|
---
|
|
4
7
|
|
|
5
|
-
#
|
|
8
|
+
# MariaDB
|
|
6
9
|
|
|
7
10
|
## Introduction
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
MariaDB can be connected to NocoBase as an external database. NocoBase reads tables, fields, and views from MariaDB and makes them available as collections in the external data source.
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
Unlike a [main data source](../main/index.md), the actual schema of an external MariaDB database continues to be maintained by the original business system, database client, or migration scripts. NocoBase reads the schema, stores field metadata, and lets you configure blocks, permissions, workflows, and APIs.
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
| Setting | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| Supported version | MariaDB >= 10.3. |
|
|
19
|
+
| Commercial editions | Available in Standard, Professional, and Enterprise editions. |
|
|
20
|
+
| Plugin | `@nocobase/plugin-data-source-external-mariadb`. |
|
|
21
|
+
| Compatible protocol | Connects through the MySQL protocol. Field mapping generally follows MySQL compatibility rules. |
|
|
14
22
|
|
|
23
|
+
External MariaDB is suitable when you need to:
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
- Connect a MariaDB database used by an existing ERP, MES, WMS, CRM, or other business system
|
|
26
|
+
- Build management pages in NocoBase without migrating historical data
|
|
27
|
+
- Apply permissions, workflow processing, data corrections, or reporting to existing tables
|
|
28
|
+
- Keep the database schema maintained by DBAs, migration scripts, or the original system
|
|
17
29
|
|
|
18
|
-
|
|
30
|
+
:::warning Note
|
|
31
|
+
|
|
32
|
+
An external MariaDB database is not a NocoBase system database. NocoBase does not manage its backups, restores, migrations, or schema changes.
|
|
33
|
+
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
## Plugin installation
|
|
37
|
+
|
|
38
|
+
This is a commercial plugin. For activation instructions, see the [Commercial plugin activation guide](https://www.nocobase.com/en/blog/nocobase-commercial-license-activation-guide).
|
|
39
|
+
|
|
40
|
+
## Add a data source
|
|
41
|
+
|
|
42
|
+
In **Data source management**, click **Add new**, select MariaDB, and then enter the connection details.
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
Common connection settings are as follows:
|
|
47
|
+
|
|
48
|
+
| Setting | Description |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| Data source name | The internal identifier used by blocks, permissions, workflows, and APIs. It cannot be changed after the data source is created. |
|
|
51
|
+
| Data source display name | The name displayed in the interface. Use a name that business users can recognize, such as `ERP MariaDB` or `Order database`. |
|
|
52
|
+
| Host / Port | The MariaDB host address and port. The default port is usually `3306`. |
|
|
53
|
+
| Database | The name of the MariaDB database to connect to. |
|
|
54
|
+
| Username / Password | The account credentials used to connect to MariaDB. NocoBase can read only objects that this account is allowed to access; it does not grant access to, or read, objects private to other accounts. |
|
|
55
|
+
| Table prefix | A table-name prefix. When configured, NocoBase reads only tables and views that match the prefix, and removes the prefix from the generated NocoBase collection names. |
|
|
56
|
+
| Collections / Add all collections | Controls the connection scope. With **Add all collections** enabled, NocoBase connects all tables and views in the current scope. When disabled, it connects only the objects selected in **Collections**. |
|
|
57
|
+
| Enabled the data source | Whether to enable the data source. When disabled, its configuration is retained, but blocks, permissions, workflows, and APIs can no longer read its data. |
|
|
58
|
+
|
|
59
|
+
:::tip Tip
|
|
60
|
+
|
|
61
|
+
When MariaDB contains many objects, narrow the scope through `Database`, `Table prefix`, and **Collections** first. Connecting only the tables and views used by the current application keeps permissions, page building, and synchronization easier to maintain.
|
|
62
|
+
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
## Select collections
|
|
66
|
+
|
|
67
|
+
After entering connection details, click **Load Collections** to read available tables and views from MariaDB. The results depend on the connection account, `Database`, `Table prefix`, and **Collections** settings.
|
|
68
|
+
|
|
69
|
+
By default, **Add all collections** is enabled, which connects all tables and views in the current scope. To connect only selected objects, disable **Add all collections** and select the required tables or views from the list.
|
|
70
|
+
|
|
71
|
+

|
|
72
|
+
|
|
73
|
+
:::warning Note
|
|
74
|
+
|
|
75
|
+
An external data source can connect up to 500 tables or views at a time. When MariaDB contains many objects, narrow the scope through `Database`, `Table prefix`, or **Collections** first.
|
|
76
|
+
|
|
77
|
+
:::
|
|
78
|
+
|
|
79
|
+
## Synchronize and configure fields
|
|
80
|
+
|
|
81
|
+
The external MariaDB schema is maintained in MariaDB. NocoBase does not create fields, change field types, or delete actual fields in the external database.
|
|
82
|
+
|
|
83
|
+
When the MariaDB schema changes, run **Sync from database** from the data source to read collection and field metadata again. Synchronization updates the collections, fields, primary keys, unique keys, and field-type mapping metadata stored in NocoBase. It does not delete actual MariaDB tables or data.
|
|
84
|
+
|
|
85
|
+
After fields are synchronized, you can configure their titles, Field type, and Field interface in NocoBase. NocoBase relationship fields are also stored as relationship metadata in NocoBase and do not automatically add actual foreign-key columns to MariaDB tables.
|
|
86
|
+
|
|
87
|
+
## Field type mapping
|
|
88
|
+
|
|
89
|
+
NocoBase automatically maps MariaDB types to appropriate Field types and Field interfaces. Common MariaDB mappings are largely the same as MySQL mappings, and you can adjust the display interface in field settings.
|
|
90
|
+
|
|
91
|
+
| MariaDB type | NocoBase Field type | Available Field interfaces |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `TINYINT`, `SMALLINT`, `MEDIUMINT` | `integer`, `boolean`, `sort` | Integer, Sort, Checkbox, Switch, Select, Radio group. |
|
|
94
|
+
| `INT`, `INTEGER` | `integer`, `unixTimestamp`, `sort` | Integer, Sort, Unix timestamp, Select, Radio group. |
|
|
95
|
+
| `BIGINT` | `bigInt`, `snowflakeId`, `unixTimestamp`, `sort` | Integer, Sort, Unix timestamp, Created at, Updated at. |
|
|
96
|
+
| `FLOAT`, `DOUBLE` | `float` | Number, Percent. |
|
|
97
|
+
| `DECIMAL` | `decimal` | Number, Percent, Currency. |
|
|
98
|
+
| `CHAR`, `VARCHAR` | `string`, `uuid`, `nanoid`, `encryption` | Input, Email, Phone, Password, Color, Icon, Select, Radio group, UUID, Nano ID. |
|
|
99
|
+
| `TINYTEXT`, `TEXT`, `MEDIUMTEXT`, `LONGTEXT` | `text` | Textarea, Markdown, Vditor, Rich text, URL. |
|
|
100
|
+
| `DATE` | `dateOnly` | Date. |
|
|
101
|
+
| `TIME` | `time` | Time. |
|
|
102
|
+
| `DATETIME` | `datetimeNoTz`, `datetimeTz`, `date` | Date, Time, Created at, Updated at. |
|
|
103
|
+
| `TIMESTAMP` | `datetimeTz`, `date` | Date, Time, Created at, Updated at. |
|
|
104
|
+
| `YEAR` | `string`, `integer` | Input, Integer, Date. |
|
|
105
|
+
| `JSON` | `json`, `array` | JSON. |
|
|
106
|
+
|
|
107
|
+
:::warning Note
|
|
108
|
+
|
|
109
|
+
Unsupported MariaDB types are displayed separately in field settings. They require development support before they can be used as regular NocoBase fields.
|
|
110
|
+
|
|
111
|
+
:::
|
|
112
|
+
|
|
113
|
+
## Primary key and Record unique key
|
|
114
|
+
|
|
115
|
+
Collections used for block display and editing should have a primary key or unique field. NocoBase uses the primary key as the Record unique key when available.
|
|
116
|
+
|
|
117
|
+
For views, tables without a primary key, or composite-primary-key tables, configure **Record unique key** manually in the collection settings. Without a usable identifier, blocks might not view, edit, or delete records correctly.
|
|
118
|
+
|
|
119
|
+

|
|
120
|
+

|
|
121
|
+
|
|
122
|
+
## Related links
|
|
123
|
+
|
|
124
|
+
- [External databases](./index.md) - General external-database configuration and management.
|
|
125
|
+
- [Data source management](../data-source-manager/index.md) - Data-source entry points and management.
|
|
126
|
+
- [Collection fields](../data-modeling/collection-fields/index.md) - Field types and field mapping.
|
|
@@ -1,18 +1,129 @@
|
|
|
1
1
|
---
|
|
2
2
|
pkg: "@nocobase/plugin-data-source-external-mssql"
|
|
3
|
+
title: "External data source - MSSQL"
|
|
4
|
+
description: "Learn how to connect MSSQL/SQL Server as an external database in NocoBase, including supported versions, plugin installation, connection settings, encrypted connections, permissions, and field mapping."
|
|
5
|
+
keywords: "external data source,MSSQL,SQL Server,external database,field mapping,NocoBase"
|
|
3
6
|
---
|
|
4
7
|
|
|
5
|
-
#
|
|
8
|
+
# MSSQL
|
|
6
9
|
|
|
7
10
|
## Introduction
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
MSSQL (SQL Server) can be connected to NocoBase as an external database. NocoBase reads tables, fields, and views from SQL Server and makes them available as collections in the external data source.
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
Unlike a [main data source](../main/index.md), the actual schema of an external MSSQL database continues to be maintained by the original business system, database client, or migration scripts. NocoBase reads the schema, stores field metadata, and lets you configure blocks, permissions, workflows, and APIs.
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
| Setting | Description |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| Supported version | SQL Server 2014-2019. |
|
|
19
|
+
| Commercial editions | Available in Standard, Professional, and Enterprise editions. |
|
|
20
|
+
| Plugin | `@nocobase/plugin-data-source-external-mssql`. |
|
|
21
|
+
| Connection features | Supports **Encrypt connection** and **Trust server certificate**. |
|
|
14
22
|
|
|
23
|
+
External MSSQL is suitable when you need to:
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
- Connect an SQL Server database used by an existing ERP, MES, WMS, CRM, or other business system
|
|
26
|
+
- Build management pages in NocoBase without migrating historical data
|
|
27
|
+
- Apply permissions, workflow processing, data corrections, or reporting to existing tables
|
|
28
|
+
- Keep the database schema maintained by DBAs, migration scripts, or the original system
|
|
17
29
|
|
|
18
|
-
|
|
30
|
+
:::warning Note
|
|
31
|
+
|
|
32
|
+
An external MSSQL database is not a NocoBase system database. NocoBase does not manage its backups, restores, migrations, or schema changes.
|
|
33
|
+
|
|
34
|
+
:::
|
|
35
|
+
|
|
36
|
+
## Plugin installation
|
|
37
|
+
|
|
38
|
+
This is a commercial plugin. For activation instructions, see the [Commercial plugin activation guide](https://www.nocobase.com/en/blog/nocobase-commercial-license-activation-guide).
|
|
39
|
+
|
|
40
|
+
## Add a data source
|
|
41
|
+
|
|
42
|
+
In **Data source management**, click **Add new**, select MSSQL, and then enter the connection details.
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
Common connection settings are as follows:
|
|
47
|
+
|
|
48
|
+
| Setting | Description |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| Data source name | The internal identifier used by blocks, permissions, workflows, and APIs. It cannot be changed after the data source is created. |
|
|
51
|
+
| Data source display name | The name displayed in the interface. Use a name that business users can recognize, such as `ERP SQL Server` or `Finance database`. |
|
|
52
|
+
| Host / Port | The SQL Server host address and port. The default port is usually `1433`. |
|
|
53
|
+
| Database | The name of the SQL Server database to connect to. |
|
|
54
|
+
| Username / Password | The account credentials used to connect to SQL Server. NocoBase can read only objects that this account is allowed to access; it does not grant access to, or read, objects private to other accounts. |
|
|
55
|
+
| Table prefix | A table-name prefix. When configured, NocoBase reads only tables and views that match the prefix, and removes the prefix from the generated NocoBase collection names. |
|
|
56
|
+
| Encrypt connection | Whether to enable an encrypted connection. Enable it when the database enforces encryption or the network connection requires encryption. |
|
|
57
|
+
| Trust server certificate | Whether to trust the server certificate. You might need to enable it for test environments or self-signed certificates; use a trusted certificate in production. |
|
|
58
|
+
| Collections / Add all collections | Controls the connection scope. With **Add all collections** enabled, NocoBase connects all tables and views in the current scope. When disabled, it connects only the objects selected in **Collections**. |
|
|
59
|
+
| Enabled the data source | Whether to enable the data source. When disabled, its configuration is retained, but blocks, permissions, workflows, and APIs can no longer read its data. |
|
|
60
|
+
|
|
61
|
+
:::tip Tip
|
|
62
|
+
|
|
63
|
+
When SQL Server contains many objects, narrow the scope through `Database`, `Table prefix`, and **Collections** first. Connecting only the tables and views used by the current application keeps permissions, page building, and synchronization easier to maintain.
|
|
64
|
+
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## Select collections
|
|
68
|
+
|
|
69
|
+
After entering connection details, click **Load Collections** to read available tables and views from SQL Server. The results depend on the connection account, `Database`, `Table prefix`, and **Collections** settings.
|
|
70
|
+
|
|
71
|
+
By default, **Add all collections** is enabled, which connects all tables and views in the current scope. To connect only selected objects, disable **Add all collections** and select the required tables or views from the list.
|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
:::warning Note
|
|
76
|
+
|
|
77
|
+
An external data source can connect up to 500 tables or views at a time. When SQL Server contains many objects, narrow the scope through `Database`, `Table prefix`, or **Collections** first.
|
|
78
|
+
|
|
79
|
+
:::
|
|
80
|
+
|
|
81
|
+
## Synchronize and configure fields
|
|
82
|
+
|
|
83
|
+
The external MSSQL schema is maintained in SQL Server. NocoBase does not create fields, change field types, or delete actual fields in the external database.
|
|
84
|
+
|
|
85
|
+
When the SQL Server schema changes, run **Sync from database** from the data source to read collection and field metadata again. Synchronization updates the collections, fields, primary keys, unique keys, and field-type mapping metadata stored in NocoBase. It does not delete actual SQL Server tables or data.
|
|
86
|
+
|
|
87
|
+
After fields are synchronized, you can configure their titles, Field type, and Field interface in NocoBase. NocoBase relationship fields are also stored as relationship metadata in NocoBase and do not automatically add actual foreign-key columns to SQL Server tables.
|
|
88
|
+
|
|
89
|
+
## Field type mapping
|
|
90
|
+
|
|
91
|
+
NocoBase automatically maps SQL Server types to appropriate Field types and Field interfaces. You can adjust the display interface in field settings.
|
|
92
|
+
|
|
93
|
+
| SQL Server type | NocoBase Field type | Available Field interfaces |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `BIT` | `bit` | Checkbox, Switch. |
|
|
96
|
+
| `TINYINT`, `SMALLINT` | `integer`, `boolean`, `sort` | Integer, Sort, Checkbox, Switch, Select, Radio group. |
|
|
97
|
+
| `INT` | `integer`, `unixTimestamp`, `sort` | Integer, Sort, Unix timestamp, Select, Radio group. |
|
|
98
|
+
| `BIGINT` | `bigInt`, `unixTimestamp`, `sort` | Integer, Sort, Unix timestamp, Created at, Updated at. |
|
|
99
|
+
| `DECIMAL`, `MONEY`, `SMALLMONEY` | `decimal` | Number, Percent, Currency. |
|
|
100
|
+
| `NUMERIC`, `FLOAT`, `REAL` | `float` | Number, Percent. |
|
|
101
|
+
| `CHAR`, `VARCHAR`, `NCHAR`, `NVARCHAR` | `string`, `uuid`, `nanoid` | Input, Email, Phone, Password, Color, Icon, Select, Radio group, UUID, Nano ID. |
|
|
102
|
+
| `TEXT`, `NTEXT` | `text` | Textarea, Markdown, Vditor, Rich text, URL. |
|
|
103
|
+
| `DATE` | `dateOnly` | Date. |
|
|
104
|
+
| `TIME` | `time` | Time. |
|
|
105
|
+
| `DATETIME`, `DATETIME2` | `datetimeNoTz` | Date, Time, Created at, Updated at. |
|
|
106
|
+
| `DATETIMEOFFSET` | `datetimeTz` | Date, Time, Created at, Updated at. |
|
|
107
|
+
| `UNIQUEIDENTIFIER` | `uuid`, `string` | UUID, Input. |
|
|
108
|
+
| `JSON` | `json`, `array` | JSON. |
|
|
109
|
+
|
|
110
|
+
:::warning Note
|
|
111
|
+
|
|
112
|
+
Unsupported SQL Server types are displayed separately in field settings. They require development support before they can be used as regular NocoBase fields.
|
|
113
|
+
|
|
114
|
+
:::
|
|
115
|
+
|
|
116
|
+
## Primary key and Record unique key
|
|
117
|
+
|
|
118
|
+
Collections used for block display and editing should have a primary key or unique field. NocoBase uses the primary key as the Record unique key when available.
|
|
119
|
+
|
|
120
|
+
For views, tables without a primary key, or composite-primary-key tables, configure **Record unique key** manually in the collection settings. Without a usable identifier, blocks might not view, edit, or delete records correctly.
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+

|
|
124
|
+
|
|
125
|
+
## Related links
|
|
126
|
+
|
|
127
|
+
- [External databases](./index.md) - General external-database configuration and management.
|
|
128
|
+
- [Data source management](../data-source-manager/index.md) - Data-source entry points and management.
|
|
129
|
+
- [Collection fields](../data-modeling/collection-fields/index.md) - Field types and field mapping.
|