@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.
Files changed (246) hide show
  1. package/dist/ai/docs/nocobase/ai-employees/block/ai-chat-box.md +133 -0
  2. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/documents.md +1 -1
  3. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/index.md +11 -7
  4. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/knowledge-base/settings.md +12 -8
  5. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-database.md +3 -3
  6. package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/create-document.md +1 -1
  7. package/dist/ai/docs/nocobase/api/app/env.md +3 -1
  8. package/dist/ai/docs/nocobase/api/cli/index.md +14 -2
  9. package/dist/ai/docs/nocobase/api/cli/portal/config.md +44 -0
  10. package/dist/ai/docs/nocobase/api/cli/portal/create.md +48 -0
  11. package/dist/ai/docs/nocobase/api/cli/portal/deploy.md +39 -0
  12. package/dist/ai/docs/nocobase/api/cli/portal/destroy.md +41 -0
  13. package/dist/ai/docs/nocobase/api/cli/portal/dev.md +39 -0
  14. package/dist/ai/docs/nocobase/api/cli/portal/index.md +136 -0
  15. package/dist/ai/docs/nocobase/api/cli/portal/info.md +41 -0
  16. package/dist/ai/docs/nocobase/api/cli/portal/list.md +40 -0
  17. package/dist/ai/docs/nocobase/api/cli/portal/pull.md +43 -0
  18. package/dist/ai/docs/nocobase/api/cli/portal/push.md +41 -0
  19. package/dist/ai/docs/nocobase/building-tips/ai-fill-js-block-form.md +1092 -0
  20. package/dist/ai/docs/nocobase/data-sources/calendar/calendar-collection.md +100 -3
  21. package/dist/ai/docs/nocobase/data-sources/collection-comment/index.md +92 -39
  22. package/dist/ai/docs/nocobase/data-sources/collection-sql/index.md +150 -29
  23. package/dist/ai/docs/nocobase/data-sources/collection-tree/index.md +93 -5
  24. package/dist/ai/docs/nocobase/data-sources/collection-view/index.md +226 -4
  25. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/china-region.md +122 -5
  26. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/collection-select.md +105 -4
  27. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/json.md +102 -4
  28. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/nano-id.md +104 -4
  29. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/snowflake-id.md +108 -4
  30. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/sort.md +3 -19
  31. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/advanced/uuid.md +104 -4
  32. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/associations/index.md +44 -8
  33. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/color.md +102 -4
  34. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/email.md +104 -4
  35. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/icon.md +102 -4
  36. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/input.md +112 -8
  37. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/integer.md +103 -4
  38. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/number.md +103 -4
  39. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/password.md +102 -4
  40. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/percent.md +104 -5
  41. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/phone.md +104 -4
  42. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/textarea.md +99 -8
  43. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/basic/url.md +103 -4
  44. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox-group.md +105 -3
  45. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/checkbox.md +102 -4
  46. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/china-region.md +108 -5
  47. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/multiple-select.md +103 -5
  48. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/radio-group.md +106 -4
  49. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/choices/select.md +103 -5
  50. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/date.md +102 -4
  51. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime-without-tz.md +103 -5
  52. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/datetime.md +103 -5
  53. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/index.md +53 -47
  54. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/time.md +102 -4
  55. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/datetime/unix-timestamp.md +103 -5
  56. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/circle.md +102 -4
  57. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/line.md +103 -5
  58. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/point.md +102 -4
  59. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/geometric/polygon.md +102 -4
  60. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/index.md +62 -16
  61. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/markdown.md +104 -4
  62. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/media/rich-text.md +105 -5
  63. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-at.md +105 -5
  64. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/created-by.md +103 -5
  65. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/space.md +100 -6
  66. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/table-oid.md +102 -4
  67. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-at.md +104 -5
  68. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/system-info/updated-by.md +104 -6
  69. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection-fields/validation.md +68 -58
  70. package/dist/ai/docs/nocobase/data-sources/data-modeling/collection.md +32 -13
  71. package/dist/ai/docs/nocobase/data-sources/data-modeling/index.md +41 -33
  72. package/dist/ai/docs/nocobase/data-sources/data-source-external-mariadb/index.md +114 -6
  73. package/dist/ai/docs/nocobase/data-sources/data-source-external-mssql/index.md +117 -6
  74. package/dist/ai/docs/nocobase/data-sources/data-source-external-mysql/index.md +103 -6
  75. package/dist/ai/docs/nocobase/data-sources/data-source-external-nocobase/index.md +75 -73
  76. package/dist/ai/docs/nocobase/data-sources/data-source-external-oracle/index.md +129 -11
  77. package/dist/ai/docs/nocobase/data-sources/data-source-external-postgres/index.md +110 -6
  78. package/dist/ai/docs/nocobase/data-sources/data-source-kingbase/index.md +75 -49
  79. package/dist/ai/docs/nocobase/data-sources/data-source-main/general-collection.md +116 -15
  80. package/dist/ai/docs/nocobase/data-sources/data-source-main/index.md +92 -62
  81. package/dist/ai/docs/nocobase/data-sources/data-source-main/inheritance-collection.md +97 -10
  82. package/dist/ai/docs/nocobase/data-sources/data-source-manager/external-database.md +97 -58
  83. package/dist/ai/docs/nocobase/data-sources/data-source-manager/index.md +32 -24
  84. package/dist/ai/docs/nocobase/data-sources/data-source-rest-api/index.md +115 -153
  85. package/dist/ai/docs/nocobase/data-sources/external/clickhouse.md +124 -0
  86. package/dist/ai/docs/nocobase/data-sources/external/doris.md +130 -0
  87. package/dist/ai/docs/nocobase/data-sources/external/index.md +140 -0
  88. package/dist/ai/docs/nocobase/data-sources/external/kingbase.md +129 -0
  89. package/dist/ai/docs/nocobase/data-sources/external/mariadb.md +126 -0
  90. package/dist/ai/docs/nocobase/data-sources/external/mssql.md +129 -0
  91. package/dist/ai/docs/nocobase/data-sources/external/mysql.md +115 -0
  92. package/dist/ai/docs/nocobase/data-sources/external/nocobase.md +159 -0
  93. package/dist/ai/docs/nocobase/data-sources/external/oceanbase.md +126 -0
  94. package/dist/ai/docs/nocobase/data-sources/external/oracle.md +158 -0
  95. package/dist/ai/docs/nocobase/data-sources/external/postgresql.md +122 -0
  96. package/dist/ai/docs/nocobase/data-sources/external/rest-api.md +245 -0
  97. package/dist/ai/docs/nocobase/data-sources/field-attachment-url/index.md +100 -12
  98. package/dist/ai/docs/nocobase/data-sources/field-encryption/index.md +48 -47
  99. package/dist/ai/docs/nocobase/data-sources/field-formula/index.md +99 -5
  100. package/dist/ai/docs/nocobase/data-sources/field-markdown-vditor/index.md +105 -5
  101. package/dist/ai/docs/nocobase/data-sources/field-sequence/index.md +102 -5
  102. package/dist/ai/docs/nocobase/data-sources/field-signature/index.md +18 -16
  103. package/dist/ai/docs/nocobase/data-sources/field-sort/index.md +76 -73
  104. package/dist/ai/docs/nocobase/data-sources/file-manager/field-attachment.md +101 -7
  105. package/dist/ai/docs/nocobase/data-sources/file-manager/file-collection.md +101 -14
  106. package/dist/ai/docs/nocobase/data-sources/index.md +49 -33
  107. package/dist/ai/docs/nocobase/data-sources/main/index.md +130 -0
  108. package/dist/ai/docs/nocobase/data-sources/main/kingbase.md +147 -0
  109. package/dist/ai/docs/nocobase/data-sources/main/mariadb.md +59 -0
  110. package/dist/ai/docs/nocobase/data-sources/main/mysql.md +59 -0
  111. package/dist/ai/docs/nocobase/data-sources/main/oceanbase.md +62 -0
  112. package/dist/ai/docs/nocobase/data-sources/main/postgresql.md +61 -0
  113. package/dist/ai/docs/nocobase/file-manager/storage/index.md +66 -26
  114. package/dist/ai/docs/nocobase/file-manager/storage/s3-pro.md +58 -7
  115. package/dist/ai/docs/nocobase/get-started/installation/env.md +2 -2
  116. package/dist/ai/docs/nocobase/ops-management/migration-manager/built-in-tables.md +1 -2
  117. package/dist/ai/docs/nocobase/runjs/context/ai.md +194 -4
  118. package/dist/ai/tools/executeFrontendTool.d.ts +10 -0
  119. package/dist/ai/tools/executeFrontendTool.js +86 -0
  120. package/dist/ai/tools/getSkill.js +1 -1
  121. package/dist/ai/tools/loadFrontendTool.d.ts +10 -0
  122. package/dist/ai/tools/loadFrontendTool.js +99 -0
  123. package/dist/client/244.8631eb5cf3f05e21.js +10 -0
  124. package/dist/client/{525.203778500aca5d05.js → 525.94dd4136c1361477.js} +1 -1
  125. package/dist/client/681.6ffbc9329b9ac242.js +10 -0
  126. package/dist/{client-v2/705.1d10027ff8cfdf79.js → client/705.19b642db34de438a.js} +1 -1
  127. package/dist/client/index.d.ts +1 -3
  128. package/dist/client/index.js +8 -8
  129. package/dist/client-v2/244.c428e645ecb94414.js +10 -0
  130. package/dist/client-v2/420.b2aedb1ff71fca0e.js +10 -0
  131. package/dist/client-v2/681.6890caa389564ff7.js +10 -0
  132. package/dist/client-v2/705.8dc34d43f02f322c.js +10 -0
  133. package/dist/client-v2/ai-employees/AIEmployeeShortcut.d.ts +2 -0
  134. package/dist/client-v2/ai-employees/AddContextButton.d.ts +2 -0
  135. package/dist/client-v2/ai-employees/chatbox/components/AIEmployeeSwitcher.d.ts +1 -0
  136. package/dist/client-v2/ai-employees/chatbox/components/ChatBoxUnreadBadge.d.ts +17 -0
  137. package/dist/client-v2/ai-employees/chatbox/components/Conversations.d.ts +9 -1
  138. package/dist/client-v2/ai-employees/chatbox/components/MessageRenderers.d.ts +1 -1
  139. package/dist/client-v2/ai-employees/chatbox/components/Messages.d.ts +5 -1
  140. package/dist/client-v2/ai-employees/chatbox/components/ModelSwitcher.d.ts +4 -0
  141. package/dist/client-v2/ai-employees/chatbox/components/Sender.d.ts +33 -1
  142. package/dist/client-v2/ai-employees/chatbox/components/index.d.ts +1 -0
  143. package/dist/client-v2/ai-employees/chatbox/hooks/useChat.d.ts +8 -5
  144. package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxActions.d.ts +3 -2
  145. package/dist/client-v2/ai-employees/chatbox/hooks/useChatBoxEffect.d.ts +2 -1
  146. package/dist/client-v2/ai-employees/chatbox/hooks/useChatConversationActions.d.ts +3 -2
  147. package/dist/client-v2/ai-employees/chatbox/hooks/useChatMessageActions.d.ts +4 -2
  148. package/dist/client-v2/ai-employees/chatbox/hooks/useToolCallActions.d.ts +3 -1
  149. package/dist/client-v2/ai-employees/chatbox/hooks/useUploadFiles.d.ts +13 -3
  150. package/dist/client-v2/ai-employees/chatbox/hooks/useWorkflowTasks.d.ts +3 -2
  151. package/dist/client-v2/ai-employees/chatbox/index.d.ts +17 -0
  152. package/dist/client-v2/ai-employees/chatbox/roles.d.ts +2 -153
  153. package/dist/client-v2/ai-employees/chatbox/stores/chat-box.d.ts +46 -31
  154. package/dist/client-v2/ai-employees/chatbox/stores/chat-conversations.d.ts +7 -7
  155. package/dist/client-v2/ai-employees/chatbox/stores/chat-messages.d.ts +23 -18
  156. package/dist/client-v2/ai-employees/chatbox/stores/chat-sender.d.ts +43 -0
  157. package/dist/client-v2/ai-employees/chatbox/stores/chat-tool-call.d.ts +6 -5
  158. package/dist/client-v2/ai-employees/chatbox/stores/chat-tools.d.ts +11 -5
  159. package/dist/client-v2/ai-employees/chatbox/stores/mounted-chat-boxes.d.ts +20 -0
  160. package/dist/client-v2/ai-employees/chatbox/stores/runtime.d.ts +43 -0
  161. package/dist/client-v2/ai-employees/chatbox/stores/workflow-tasks.d.ts +22 -10
  162. package/dist/client-v2/ai-employees/chatbox/upload.d.ts +19 -0
  163. package/dist/client-v2/ai-employees/chatbox/utils.d.ts +28 -4
  164. package/dist/client-v2/ai-employees/frontend-tools.d.ts +11 -0
  165. package/dist/client-v2/ai-employees/tools/SuggestionsOptionsCard.d.ts +1 -1
  166. package/dist/client-v2/ai-employees/tools/WorkflowTaskOutputCard.d.ts +1 -1
  167. package/dist/client-v2/ai-employees/types.d.ts +30 -0
  168. package/dist/client-v2/block/ai-chat-box/AIChatBoxBlockModel.d.ts +21 -0
  169. package/dist/client-v2/block/ai-chat-box/AIChatBoxCoreModel.d.ts +13 -0
  170. package/dist/client-v2/block/ai-chat-box/components/AIChatBoxCoreView.d.ts +10 -0
  171. package/dist/client-v2/block/ai-chat-box/components/AIChatBoxView.d.ts +12 -0
  172. package/dist/client-v2/block/ai-chat-box/index.d.ts +14 -0
  173. package/dist/client-v2/block/ai-chat-box/settings.d.ts +12 -0
  174. package/dist/client-v2/block/ai-chat-box/sub-models.d.ts +26 -0
  175. package/dist/client-v2/block/ai-chat-box/types.d.ts +38 -0
  176. package/dist/client-v2/block/ai-chat-box/utils.d.ts +26 -0
  177. package/dist/client-v2/index.d.ts +3 -5
  178. package/dist/client-v2/index.js +3 -3
  179. package/dist/client-v2/llm-services/model-select.d.ts +33 -0
  180. package/dist/client-v2/llm-services/utils.d.ts +1 -0
  181. package/dist/client-v2/manager/ai-manager.d.ts +10 -3
  182. package/dist/client-v2/manager/frontend-tool-registry.d.ts +30 -0
  183. package/dist/client-v2/models/ai-employees/AIEmployeeActionModel.d.ts +4 -1
  184. package/dist/client-v2/models/ai-employees/AIEmployeeShortcutModel.d.ts +5 -0
  185. package/dist/client-v2/pages/EmployeesPage.d.ts +2 -0
  186. package/dist/client-v2/runjs/registerAIEmployeeRunJSFacade.d.ts +1 -0
  187. package/dist/common/ai-employee-validation.d.ts +15 -0
  188. package/dist/common/ai-employee-validation.js +61 -0
  189. package/dist/common/error-codes.d.ts +13 -0
  190. package/dist/common/error-codes.js +48 -0
  191. package/dist/common/frontend-tools.d.ts +26 -0
  192. package/dist/common/frontend-tools.js +57 -0
  193. package/dist/common/llm-service-models.d.ts +16 -0
  194. package/dist/common/llm-service-models.js +84 -0
  195. package/dist/externalVersion.js +16 -16
  196. package/dist/locale/en-US.json +67 -0
  197. package/dist/locale/zh-CN.json +67 -0
  198. package/dist/node_modules/@langchain/mistralai/package.json +1 -1
  199. package/dist/node_modules/@langchain/xai/package.json +1 -1
  200. package/dist/node_modules/fs-extra/package.json +1 -1
  201. package/dist/node_modules/jsonrepair/package.json +1 -1
  202. package/dist/node_modules/just-bash/package.json +1 -1
  203. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  204. package/dist/node_modules/openai/package.json +1 -1
  205. package/dist/node_modules/zod/package.json +1 -1
  206. package/dist/server/ai-employees/ai-conversations.d.ts +4 -1
  207. package/dist/server/ai-employees/ai-conversations.js +2 -0
  208. package/dist/server/ai-employees/ai-employee.d.ts +2 -1
  209. package/dist/server/ai-employees/ai-employee.js +26 -7
  210. package/dist/server/ai-employees/middleware/conversation.js +9 -2
  211. package/dist/server/collections/ai-conversations.js +5 -0
  212. package/dist/server/document-loader/constants.js +1 -1
  213. package/dist/server/frontend-tools.d.ts +25 -0
  214. package/dist/server/frontend-tools.js +171 -0
  215. package/dist/server/manager/work-context-handler.js +10 -3
  216. package/dist/server/plugin.d.ts +1 -0
  217. package/dist/server/plugin.js +25 -0
  218. package/dist/server/resource/aiConversations.d.ts +2 -0
  219. package/dist/server/resource/aiConversations.js +33 -3
  220. package/dist/server/resource/aiEmployees.d.ts +2 -0
  221. package/dist/server/resource/aiEmployees.js +62 -0
  222. package/dist/server/resource/aiWorkflowTasks.js +9 -1
  223. package/dist/server/resource/llmServices.d.ts +11 -0
  224. package/dist/server/resource/llmServices.js +85 -0
  225. package/dist/server/types/knowledge-base.type.d.ts +6 -2
  226. package/dist/swagger/common.d.ts +143 -0
  227. package/dist/swagger/common.js +144 -0
  228. package/dist/swagger/employees.d.ts +301 -0
  229. package/dist/swagger/employees.js +131 -0
  230. package/dist/swagger/index.d.ts +1588 -0
  231. package/dist/swagger/index.js +62 -0
  232. package/dist/swagger/llm.d.ts +555 -0
  233. package/dist/swagger/llm.js +247 -0
  234. package/dist/swagger/schemas.d.ts +736 -0
  235. package/dist/swagger/schemas.js +381 -0
  236. package/package.json +2 -2
  237. package/dist/ai/docs/nocobase/ai-employees/knowledge-base/vector-store.md +0 -24
  238. package/dist/ai/docs/nocobase/data-sources/development/index.md +0 -6
  239. package/dist/client/372.40eb52905e3f3049.js +0 -10
  240. package/dist/client/681.399948c18d753667.js +0 -10
  241. package/dist/client/705.380279da896021fb.js +0 -10
  242. package/dist/client-v2/372.8cc3fde09c9bec77.js +0 -10
  243. package/dist/client-v2/406.341be51205c674e0.js +0 -10
  244. package/dist/client-v2/681.082f4f1c7b841983.js +0 -10
  245. package/dist/client-v2/ai-employees/chatbox/stores/create-selectors.d.ts +0 -46
  246. package/dist/client-v2/ai-employees/chatbox/utils/normalizeTriggerTaskOptions.d.ts +0 -19
@@ -1,19 +1,113 @@
1
1
  ---
2
- pkg: "@nocobase/plugin-file-manager"
2
+ title: "Attachment"
3
+ description: "The Attachment field uploads files and relates file records to the current business record."
4
+ keywords: "Attachment,attachment,field,Field interface,NocoBase"
3
5
  ---
4
6
 
5
- # Attachment Field
7
+ # Attachment
6
8
 
7
9
  ## Introduction
8
10
 
9
- The attachment field is a specialized relational field that connects directly to the file collection.
11
+ In NocoBase, **Attachment** uploads files and relates file records to the current business record.
10
12
 
11
- ## Field Configuration
13
+ It normally relates to a File collection. The file binary is stored by a file-storage engine, while metadata such as file name, size, URL, and MIME type is stored in the File collection. Use Attachment URL for external file links.
12
14
 
15
+ ## Use cases
13
16
 
14
- ![20240512180916](https://static-docs.nocobase.com/20240512180916.png)
17
+ Attachment fields are suitable for these business scenarios:
15
18
 
19
+ - Contract attachments
20
+ - Invoice files
21
+ - Product images
22
+ - Files uploaded for business records
16
23
 
17
- ## Example
24
+ ## Create and configure
18
25
 
19
- (Example to be added)
26
+ On the collection's **Configure fields** page, click **Add field** and select **Attachment** to create this field.
27
+
28
+ ![Configure a Attachment field](https://static-docs.nocobase.com/20251031000729.png)
29
+
30
+ | Setting | Description |
31
+ | --- | --- |
32
+ | Field interface | The field interface. Attachment uses `attachment`, which determines how the field is entered and displayed in pages. |
33
+ | Field display name | The name displayed for the field, such as `Contract attachments`, `Invoice files`, or `Product images`. Use a name that business users can recognize. |
34
+ | Field name | The field identifier used internally by APIs, relation fields, permissions, and workflows. It usually cannot be changed after creation. It supports only letters, numbers, and underscores, and must begin with a letter. |
35
+ | Field type | The data-layer type. Attachment uses `association` by default. |
36
+ | Default value | The default value. When a new record has no value, NocoBase can fill this value automatically. |
37
+ | Validation rules | Validation rules. Required validation is supported; file count, size, and type are controlled by upload-component or file-storage settings. |
38
+ | Description | A field description. Record the field meaning, entry requirements, data source, or maintainer. |
39
+
40
+ :::warning Note
41
+
42
+ Field names are referenced by page blocks, permissions, workflows, and APIs after creation. Confirm the name before creating the field to avoid later configuration changes.
43
+
44
+ :::
45
+
46
+ ## Field behavior
47
+
48
+ The default behavior of a Attachment field is as follows:
49
+
50
+ | Behavior | Description |
51
+ | --- | --- |
52
+ | Default Field interface | `attachment`. |
53
+ | Default Field type | `association`. |
54
+ | Available Field types | A relation field associated with file records. |
55
+ | Page component | Uses an upload component in edit mode. |
56
+ | Filtering | Attachment filtering depends on the relation field and block capabilities. |
57
+ | Sorting | It is usually not used for sorting. |
58
+ | Validation | Required validation is supported; file count, size, and type are controlled by upload-component or file-storage settings. |
59
+
60
+ ## Edit configuration
61
+
62
+ After creation, click **Edit** beside the field to edit its configuration. Edit fields to adjust how they are displayed and used in NocoBase, such as the display name, description, default value, validation rules, or field-specific settings.
63
+
64
+ When a field comes from a synchronized main-database table, editing usually maps the database field to a NocoBase Field type and Field interface.
65
+
66
+ | Setting | Can be edited | Description |
67
+ | --- | --- | --- |
68
+ | Field display name | Yes | Changes the name displayed in the interface without changing the field identifier. |
69
+ | Field name | No | The field identifier normally cannot be changed in the edit form after creation. |
70
+ | Field interface | Conditional | Main-database fields and synchronized fields can be adjusted during field mapping. Changes affect page input, display, and validation. |
71
+ | Field type | Conditional | Main-database fields and synchronized fields can be adjusted during field mapping. Confirm that existing values can be used by the new type first. |
72
+ | Default value | Yes | Adjusts the default value for new records. |
73
+ | Validation rules | Yes | Adjusts field validation rules. |
74
+ | Description | Yes | Adds the field meaning, entry requirements, data source, or maintainer. |
75
+
76
+ :::warning Note
77
+
78
+ Changing a Field type or Field interface is more than changing a display name. It affects field storage, input components, validation rules, filters, and workflow-variable usage. When the field contains substantial existing data, confirm that its data format is compatible first.
79
+
80
+ :::
81
+
82
+ ## Delete field
83
+
84
+ Click **Delete** beside a Attachment field to delete it. You can also select multiple fields and delete them in the main data source.
85
+
86
+ Deleting a Attachment field created in the main database usually also deletes the actual database column and its values. For a synchronized or external-data-source field, the impact depends on the corresponding data source and field origin.
87
+
88
+ :::danger Warning
89
+
90
+ Deleting a field can affect page blocks, forms, filters, permissions, workflows, APIs, imports and exports, and existing data. Confirm that the field is no longer referenced by business configuration before deleting it.
91
+
92
+ :::
93
+
94
+ ## Use in pages
95
+
96
+ Attachment fields are suitable for file upload, preview, and download in business records.
97
+
98
+ ![Use a Attachment field in a page](https://static-docs.nocobase.com/20260709231642.png)
99
+
100
+
101
+ | Scenario | Use |
102
+ | --- | --- |
103
+ | Form block | Upload attachments for a business record. |
104
+ | Details block | Display, preview, or download attachments. |
105
+ | Table block | Display attachment values in lists. |
106
+ | Workflows and APIs | Use related file metadata in business logic. |
107
+
108
+ ## Related links
109
+
110
+ - [Fields](../data-modeling/collection-fields/index.md) - Learn about field categories and mapping.
111
+ - [General collection](../data-source-main/general-collection.md) - Create and manage fields in a collection.
112
+ - [File collection](../file-manager/file-collection.md) - Manage file metadata.
113
+ - [Attachment URL](../field-attachment-url/index.md) - Store external file addresses.
@@ -1,40 +1,127 @@
1
1
  ---
2
- pkg: "@nocobase/plugin-file-manager"
2
+ title: "File collection"
3
+ description: "A File collection stores file titles, names, sizes, MIME types, paths, URLs, preview addresses, storage locations, and extended metadata for use with attachment fields."
4
+ keywords: "File collection,File Collection,attachments,metadata,NocoBase"
3
5
  ---
4
6
 
5
- # File Collection
7
+ # File collection
8
+
9
+ <PluginInfo name="file-manager"></PluginInfo>
6
10
 
7
11
  ## Introduction
8
12
 
9
- Files are records in a specially structured collection known as a file collection. It is used to store file metadata and can be managed through the File Manager.
13
+ File collections are suitable for file metadata, such as file names, extensions, sizes, MIME types, paths, URLs, preview addresses, storage locations, and custom metadata. The file binary is stored by the file-storage engine; the File collection stores the file metadata.
14
+
15
+ You can create File collections only from the main data source. External databases, REST API data sources, and External NocoBase data sources do not support creating File collections.
16
+
17
+ ## Use cases
18
+
19
+ File collections are suitable for these business scenarios:
20
+
21
+ - Contract attachments, invoice files, and reimbursement receipts
22
+ - Product images, employee certificates, and project documents
23
+ - Files uploaded, previewed, and downloaded from business records
24
+ - Attachment libraries that need independent management of file metadata
25
+
26
+ ## Usage flow
27
+
28
+ File collections are usually not used directly as main business collections. A common flow is:
29
+
30
+ 1. Create a File collection to store metadata such as file title, file name, size, type, URL, and storage location.
31
+ 2. Create a relation field in the business collection and relate it to the File collection. For example, relate a `Contract attachments` File collection to the `Contracts` collection.
32
+ 3. Add the relation field to a Form block for the business collection so that users can upload files while creating or editing a business record.
33
+ 4. After upload, NocoBase writes file metadata to the File collection and relates the file record to the current business record through the relation field.
34
+ 5. Display the attachment field in a Details block, Table block, or List block for the business collection so that users can view, preview, or download files.
35
+
36
+ ## Create and configure
37
+
38
+ In the main data source, click **Create collection** and select **File collection** to create a File collection.
39
+
40
+ ![Create a File collection](https://static-docs.nocobase.com/20240324090414.png)
41
+
42
+ File collection settings are mostly the same as those for a general collection. A File collection includes file-metadata fields for storing uploaded file titles, paths, URLs, storage locations, and extended information.
43
+
44
+ | Setting | Description |
45
+ | --- | --- |
46
+ | Collection display name | The name displayed for the collection, such as `Contract attachments`, `Invoice files`, or `Product images`. |
47
+ | Collection name | The collection identifier used internally by APIs, relation fields, permissions, and workflows. |
48
+ | Categories | Collection categories affect only organization in Data source management; they do not change the collection structure. |
49
+ | Description | A description of the collection. State which files it stores, who uploads them, and which business collections use them. |
50
+ | Preset fields | Preset fields. Keep system fields and File collection built-in fields when creating a File collection. |
51
+
52
+ ### Built-in fields
53
+
54
+ After a File collection is created, it usually includes the following built-in fields. File binaries are stored in file storage, while the File collection stores this metadata.
55
+
56
+ | Field | Field name | Description |
57
+ | --- | --- | --- |
58
+ | ID | `id` | The default primary key that uniquely identifies a file record. |
59
+ | Title | `title` | The file title, normally used for display in the interface. |
60
+ | File name | `filename` | The file name. |
61
+ | Extension name | `extname` | The file extension. |
62
+ | Size | `size` | The file size. |
63
+ | MIME type | `mimetype` | The file MIME type. |
64
+ | Path | `path` | The path of the file in storage. |
65
+ | URL | `url` | The file access address. |
66
+ | Preview | `preview` | The file preview address. |
67
+ | Storage | `storage` / `storageId` | The storage to which the file belongs. `storage` is a relation field and `storageId` is its corresponding foreign key. |
68
+ | Meta | `meta` | Extended file metadata. |
69
+ | Created at | `createdAt` | Automatically records when the file record was created. |
70
+ | Created by | `createdBy` | Automatically records the user who uploaded or created the file record. |
71
+ | Updated at | `updatedAt` | Automatically records when the file record was last updated. |
72
+ | Updated by | `updatedBy` | Automatically records the user who last updated the file record. |
73
+ | Space | `space` | Available after enabling the [Multi-space plugin](../../multi-app/multi-space/index.md). It isolates data by space and does not appear when Multi-space is not enabled. |
74
+
75
+ ![File collection built-in fields](https://static-docs.nocobase.com/20240324090527.png)
76
+
77
+ ### Primary key field
78
+
79
+ Like a general collection, a File collection needs a primary key. Attachment fields and relation fields use the primary key to relate file metadata records.
10
80
 
11
- ## User Manual
81
+ If a File collection has no primary key, set **Record unique key** when editing the collection. Otherwise, attachment records might not be related, previewed, or edited correctly.
12
82
 
13
- Creating a File Collection
83
+ ## Create a relation
14
84
 
85
+ Create a relation field in the business collection and relate it to the File collection.
15
86
 
16
- ![20240324090414](https://static-docs.nocobase.com/20240324090414.png)
87
+ ![Create a relation to a File collection](https://static-docs.nocobase.com/20240324091529.png)
17
88
 
89
+ ## Use in pages
18
90
 
19
- Preset Fields in a File Collection
91
+ File collection data is usually created automatically when files are uploaded through attachment interfaces. Use it in Form blocks, Details blocks, or relation blocks.
20
92
 
93
+ ![Configure an attachment field](https://static-docs.nocobase.com/20260710160424.png)
21
94
 
22
- ![20240324090527](https://static-docs.nocobase.com/20240324090527.png)
95
+ ![Use a File collection in a page](https://static-docs.nocobase.com/20240324091321.png)
23
96
 
97
+ | Configuration location | Use |
98
+ | --- | --- |
99
+ | [Form block](../../interface-builder/blocks/data-blocks/form.md) | Upload attachments in a business-collection record. |
100
+ | [Details block](../../interface-builder/blocks/data-blocks/details.md) | Display, preview, or download attachments. |
101
+ | [Table block](../../interface-builder/blocks/data-blocks/table.md) | Display attachment fields in a list. |
102
+ | [Relation block](../../interface-builder/blocks/data-blocks/table.md) | Manage file records related to the current business record directly. |
24
103
 
25
- Using in Blocks
104
+ ## Edit configuration
26
105
 
106
+ In the collection list, click **Edit** next to a File collection to change its display name, category, description, simple pagination mode, **Record unique key**, and other settings.
27
107
 
28
- ![20240324090848](https://static-docs.nocobase.com/20240324090848.png)
108
+ File metadata fields are normally written automatically during upload. Do not repurpose fields such as `url`, `path`, or `storageId` for other business meanings. To extend file-related business information, add fields such as `File type`, `Project phase`, or `Archived`.
29
109
 
110
+ ## Delete a collection
30
111
 
31
- Association Field
112
+ In the collection list, click **Delete** next to a File collection to delete it.
32
113
 
114
+ Deleting a File collection deletes file-metadata records and related collection metadata. Before deleting it, confirm whether attachment fields and relation fields in business collections, page blocks, permissions, workflows, or APIs still depend on it.
33
115
 
34
- ![20240324091529](https://static-docs.nocobase.com/20240324091529.png)
116
+ :::danger Warning
35
117
 
118
+ A File collection stores file metadata. Deleting File collection records might invalidate attachment references in business records. Whether file binaries are also deleted depends on the file storage and business configuration. Confirm that files are no longer used by the business before proceeding.
36
119
 
37
- Association Blocks
120
+ :::
38
121
 
122
+ ## Related links
39
123
 
40
- ![20240324091321](https://static-docs.nocobase.com/20240324091321.png)
124
+ - [General collection](../data-source-main/general-collection.md) - General configuration and block usage.
125
+ - [Collection fields](../data-modeling/collection-fields/index.md) - Configure attachment fields and relation fields.
126
+ - [File manager](../../plugins/@nocobase/plugin-file-manager/index.md) - Configure file storage.
127
+ - [Multi-space](../../multi-app/multi-space/index.md) - Learn about the Space field and data isolation by space.
@@ -1,53 +1,69 @@
1
+ ---
2
+ title: "Data sources overview"
3
+ description: "NocoBase data sources and data modeling: main databases, external databases, REST APIs, external NocoBase, collections, and fields."
4
+ keywords: "data source,data modeling,main database,external database,REST API,external NocoBase,collection,NocoBase"
5
+ ---
6
+
1
7
  # Overview
2
8
 
3
- Data modeling is a key step in designing databases, involving a deep analysis and abstraction process of various types of data and their interrelationships in the real world. In this process, we try to reveal the intrinsic connections between data and formalize them into data models, laying the foundation for the database structure of the information system. NocoBase is a platform driven by data models, with the following features:
9
+ Data modeling is a key part of database design. It analyzes and abstracts real-world data and the relationships between it, then describes those relationships as a data model for an information system. NocoBase is data-model driven and provides the following capabilities.
10
+
11
+ ## Connect data from different sources
12
+
13
+ NocoBase data sources can be common databases, API or SDK platforms, and files.
4
14
 
5
- ## Supports Access to Data from Various Sources
15
+ ![Data source types](https://static-docs.nocobase.com/20240512085558.png)
6
16
 
7
- NocoBase supports data sources from various origins, including common databases, API/SDK platforms, and files.
17
+ NocoBase provides the [Data Source Manager](./data-source-manager/index.md) to manage data sources and their collections. The manager provides the interface for managing all data sources; it does not connect to a source by itself. Use it together with the applicable data-source plugin.
8
18
 
9
- ![20240512085558](https://static-docs.nocobase.com/20240512085558.png)
19
+ Supported data sources include:
10
20
 
11
- NocoBase provides a [data source manager](/data-sources/data-source-manager) for managing various data sources and their collections. The data source manager plugin only provides a management interface for all data sources and does not provide the ability to directly access data sources. It needs to be used in conjunction with various data source plugins. The currently supported data sources include:
21
+ - [Main data source](./data-source-main/index.md): The NocoBase main database. It supports PostgreSQL, MySQL, MariaDB, KingbaseES, and OceanBase.
22
+ - [External PostgreSQL](./data-source-external-postgres/index.md): Connect an existing PostgreSQL database.
23
+ - [External MySQL](./data-source-external-mysql/index.md): Connect an existing MySQL database.
24
+ - [External MariaDB](./data-source-external-mariadb/index.md): Connect an existing MariaDB database.
25
+ - [External MSSQL](./data-source-external-mssql/index.md): Connect an existing SQL Server database.
26
+ - [External KingbaseES](./data-source-kingbase/index.md): Connect an existing KingbaseES database.
27
+ - [External OceanBase](./external/oceanbase.md): Connect an existing OceanBase database.
28
+ - [External Oracle](./data-source-external-oracle/index.md): Connect an existing Oracle database.
29
+ - [External ClickHouse](./external/clickhouse.md): Connect an existing ClickHouse database.
30
+ - [External Doris](./external/doris.md): Connect an existing Doris database.
31
+ - [REST API data source](./data-source-rest-api/index.md): Map a third-party system's REST API to a data source.
32
+ - [External NocoBase data source](./data-source-external-nocobase/index.md): Connect collections from another NocoBase application.
12
33
 
13
- - [Main Database](/data-sources/data-source-main): NocoBase's main database, supporting relational databases such as MySQL, PostgreSQL, and MariaDB.
14
- - [KingbaseES](/data-sources/data-source-kingbase): Use KingbaseES database as a data source, which can be used as both a main database and an external database.
15
- - [External MySQL](/data-sources/data-source-external-mysql): Use an external MySQL database as a data source.
16
- - [External MariaDB](/data-sources/data-source-external-mariadb): Use an external MariaDB database as a data source.
17
- - [External PostgreSQL](/data-sources/data-source-external-postgres): Use an external PostgreSQL database as a data source.
18
- - [External MSSQL](/data-sources/data-source-external-mssql): Use an external MSSQL (SQL Server) database as a data source.
19
- - [External Oracle](/data-sources/data-source-external-oracle): Use an external Oracle database as a data source.
34
+ ![Data source management](https://static-docs.nocobase.com/20240512083651.png)
20
35
 
21
- ![20240512083651](https://static-docs.nocobase.com/20240512083651.png)
36
+ ## Data-modeling tools
22
37
 
23
- ## Provides a Variety of Data Modeling Tools
38
+ **A simple collection management interface** lets you create different data models (collections) or connect existing ones.
24
39
 
25
- **Simple collection management interface**: Used to create various models (collections) or connect to existing ones.
40
+ ![Collection management](https://static-docs.nocobase.com/20240512090751.png)
26
41
 
27
- ![20240512090751](https://static-docs.nocobase.com/20240512090751.png)
42
+ **An ER-diagram-like visual interface** helps extract entities and their relationships from user and business requirements. It gives you a direct way to describe the data model and understand the main data entities in a system and how they are connected.
28
43
 
29
- **ER-style visual interface**: Used to extract entities and their relationships from user and business requirements. It provides an intuitive and easy-to-understand way to describe data models. Through ER diagrams, you can more clearly understand the main data entities in the system and their relationships.
44
+ ![Visual data modeling](https://static-docs.nocobase.com/20240410075906.png)
30
45
 
31
- ![20240512091042](https://static-docs.nocobase.com/20240410075906.png)
46
+ ## Create different collection types
32
47
 
33
- ## Supports Various Types of Collections
48
+ | Collection | Description |
49
+ | --- | --- |
50
+ | [General collection](./data-source-main/general-collection.md) | Includes commonly used system fields. |
51
+ | [Calendar collection](./calendar/calendar-collection.md) | Creates event collections for calendars. |
52
+ | [Comment collection](./collection-comment/index.md) | Stores comments or feedback on data. |
53
+ | [Tree collection](./collection-tree/index.md) | Stores hierarchical data. Currently it supports the adjacency-list design. |
54
+ | [File collection](./file-manager/file-collection.md) | Manages file storage. |
55
+ | [Connect a database view](./collection-view/index.md) | Connects an existing database view. |
56
+ | [SQL collection](./collection-sql/index.md) | Presents an SQL query result in a structured form; it is not a real database table. |
57
+ | [Connect external data](./collection-fdw/index.md) | Connects remote data tables through database FDW technology. |
34
58
 
35
- - [General collection](/data-sources/data-source-main/general-collection): Built-in common system fields;
36
- - [Calendar collection](/data-sources/calendar/calendar-collection): Used to create calendar-related event collections;
37
- - Comment collection: Used for storing comments or feedback on data;
38
- - [Tree collection](/data-sources/collection-tree): Tree-structured collection, currently only supports the adjacency list model;
39
- - [File collection](/data-sources/file-manager/file-collection): Used for file storage management;
40
- - [SQL collection](/data-sources/collection-sql): Not an actual database collection, but visualizes SQL queries in a structured manner;
41
- - [Connect to database view](/data-sources/collection-view): Connects to existing database views;
42
- - Expression collection: Used for dynamic expression scenarios in workflows;
43
- - [Connect to foreign data](/data-sources/collection-fdw): Allows the database system to directly access and query data in external data sources based on FDW technology.
59
+ ![Collection types](https://static-docs.nocobase.com/20240512102212.png)
44
60
 
45
- ![20240512102212](https://static-docs.nocobase.com/20240512102212.png)
61
+ For more information, see [Collections](./data-modeling/collection.md).
46
62
 
47
- For more content, see the "[Collection / Overview](/data-sources/data-modeling/collection)" section.
63
+ ## Rich field types
48
64
 
49
- ## Provides a Rich Variety of Field Types
65
+ NocoBase provides a range of field types for different business data and interface requirements.
50
66
 
51
- ![20240512110352](https://static-docs.nocobase.com/20240512110352.png)
67
+ ![Field types](https://static-docs.nocobase.com/20240512110352.png)
52
68
 
53
- For more content, see the "[Collection Fields / Overview](/data-sources/data-modeling/collection-fields)" section.
69
+ For more information, see [Collection fields](./data-modeling/collection-fields/index.md).
@@ -0,0 +1,130 @@
1
+ ---
2
+ title: "Main database"
3
+ description: "The NocoBase main database stores system and business data. It supports MySQL, PostgreSQL, MariaDB, KingbaseES, and OceanBase, table synchronization, and collection creation."
4
+ keywords: "main database,MySQL,PostgreSQL,MariaDB,KingbaseES,OceanBase,table synchronization,NocoBase"
5
+ ---
6
+
7
+ # Main database
8
+
9
+ ## Introduction
10
+
11
+ The database configured when [deploying NocoBase](/ai/install-nocobase-app) stores NocoBase system tables and can also store application business tables.
12
+
13
+ | Database | Supported version | Community | Standard | Professional | Enterprise |
14
+ | --- | --- | --- | --- | --- | --- |
15
+ | MySQL | >= 8.0.17 | Yes | Yes | Yes | Yes |
16
+ | PostgreSQL | >= 10 | Yes | Yes | Yes | Yes |
17
+ | MariaDB | >= 10.9 | Yes | Yes | Yes | Yes |
18
+ | KingbaseES | >= V9 | No | No | Yes | Yes |
19
+ | OceanBase | >= 4.3 | No | No | No | Yes |
20
+
21
+ :::tip Tip
22
+
23
+ KingbaseES supports only PostgreSQL compatibility mode. OceanBase supports only MySQL compatibility mode.
24
+
25
+ :::
26
+
27
+ ## Plugin installation
28
+
29
+ | Database | Plugin | Installation |
30
+ | --- | --- | --- |
31
+ | MySQL | None | Built in; no separate installation is required. |
32
+ | PostgreSQL | None | Built in; no separate installation is required. |
33
+ | MariaDB | None | Built in; no separate installation is required. |
34
+ | KingbaseES | `@nocobase/plugin-data-source-kingbase` | Requires a commercial license and is enabled after installation. |
35
+ | OceanBase | `@nocobase/plugin-data-source-oceanbase` | Requires a commercial license and is enabled after installation. |
36
+
37
+ ## Access the main data source
38
+
39
+ 1. Open the **Data sources** menu.
40
+ 2. Select **Main** in the data-source list and click **Configure** to manage the main database.
41
+
42
+ ![Configure the main data source](https://static-docs.nocobase.com/configure_main_datasource.png)
43
+
44
+ ## Main data-source management
45
+
46
+ The main database manages collections and fields. You can:
47
+
48
+ - **Filter**: search collections managed by the NocoBase main database.
49
+ - **Create collection**: add a business collection.
50
+ - **Edit**: change business collection metadata.
51
+ - **Delete**: delete a business collection.
52
+ - **Sync from database**: synchronize the structure of an existing database table.
53
+ - **Configure fields**: create, change, and delete collection fields.
54
+ - **+**: create, edit, and delete collection categories from the collection tabs.
55
+
56
+ ![Main data source management](https://static-docs.nocobase.com/main_datasource_management.png)
57
+
58
+ ### Synchronize existing tables from the database
59
+
60
+ ![Synchronize existing tables](https://static-docs.nocobase.com/nocobase_doc-2025-10-29-19-46-34.png)
61
+
62
+ Synchronizing existing database tables lets you manage them in NocoBase without recreating them.
63
+
64
+ - **Protect existing investment**: use existing business tables directly.
65
+ - **Flexible integration**: bring in tables created by SQL scripts or database-management tools.
66
+ - **Gradual migration**: migrate an existing system to NocoBase step by step rather than refactoring everything at once.
67
+
68
+ With **Load from database**, you can:
69
+
70
+ 1. Browse all tables in the database.
71
+ 2. Select the tables to synchronize.
72
+ 3. Identify table structures and field types automatically.
73
+ 4. Import them into NocoBase for management.
74
+
75
+ ### Supported collection types
76
+
77
+ ![Collection types](https://static-docs.nocobase.com/nocobase_doc-2025-10-29-19-47-14.png)
78
+
79
+ NocoBase supports creating and managing these collection types:
80
+
81
+ - **General collection**: includes commonly used system fields.
82
+ - **Inheritance collection**: derives child collections from a parent collection. Child collections inherit the parent structure and can define their own fields.
83
+ - **Tree collection**: a hierarchical collection that currently supports the adjacency-list design.
84
+ - **Calendar collection**: stores calendar-related event records.
85
+ - **File collection**: manages file storage.
86
+ - **SQL collection**: presents an SQL query result in a structured form; it is not a real database table.
87
+ - **Database view collection**: connects an existing database view.
88
+
89
+ ### Collection categories
90
+
91
+ ![Collection categories](https://static-docs.nocobase.com/20240322231520.png)
92
+
93
+ ### Rich field types
94
+
95
+ ![Field types](https://static-docs.nocobase.com/nocobase_doc-2025-10-29-19-48-51.png)
96
+
97
+ #### Flexible field type conversion
98
+
99
+ NocoBase supports flexible Field interface conversion when the underlying database type is compatible.
100
+
101
+ For example, a database string field can be presented as:
102
+
103
+ - **Basic types**: Single line text, Multiline text, Phone, Email, URL, Password, Color, or Icon.
104
+ - **Choice types**: Select or Radio group.
105
+ - **Media types**: Markdown, Markdown (Vditor), Rich text, or Attachment URL.
106
+ - **Date and time types**: Date time with timezone or Date time without timezone.
107
+ - **Advanced types**: Sequence, Collection selector, or Encryption.
108
+
109
+ This conversion does not change the underlying database storage type. It lets you adjust presentation and interaction as business requirements change while preserving existing data.
110
+
111
+ ### Field-level synchronization
112
+
113
+ NocoBase can synchronize fields individually as well as synchronize an entire collection.
114
+
115
+ ![Field-level synchronization](https://static-docs.nocobase.com/nocobase_doc-2025-10-29-19-49-56.png)
116
+
117
+ #### Field synchronization behavior
118
+
119
+ 1. Synchronize newly added fields after the database schema changes.
120
+ 2. Select only the fields you need rather than synchronizing every field.
121
+ 3. Identify database field types and map them to NocoBase Field types automatically.
122
+ 4. Preserve existing data during synchronization.
123
+
124
+ #### Use cases
125
+
126
+ - **Database schema evolution**: synchronize fields added for new business requirements.
127
+ - **Team collaboration**: synchronize fields added by another team member or DBA.
128
+ - **Hybrid management**: combine fields managed in NocoBase with fields managed by traditional database tools.
129
+
130
+ See [Collection fields](../data-modeling/collection-fields/index.md) for details.
@@ -0,0 +1,147 @@
1
+ ---
2
+ pkg: "@nocobase/plugin-data-source-kingbase"
3
+ title: "Main data source - KingbaseES"
4
+ description: "Learn KingbaseES version support, installation, environment variables, Docker deployment, usage, and field mapping for the NocoBase main database."
5
+ keywords: "main data source,KingbaseES,main database,PostgreSQL compatibility mode,field mapping,NocoBase"
6
+ ---
7
+
8
+ # KingbaseES
9
+
10
+ ## Introduction
11
+
12
+ KingbaseES can be used as the NocoBase main database. It stores NocoBase system-table data and business data in the main data source. Configure it when deploying NocoBase; it cannot be deleted after the application is running.
13
+
14
+ To connect an existing KingbaseES database as an external database, see [External KingbaseES](../external/kingbase.md).
15
+
16
+ | Setting | Description |
17
+ | --- | --- |
18
+ | Supported version | >= V9. |
19
+ | Commercial editions | Professional and Enterprise. |
20
+ | Database type | PostgreSQL compatibility mode. |
21
+
22
+ :::warning Note
23
+
24
+ Only KingbaseES databases running in PostgreSQL compatibility mode are supported.
25
+
26
+ :::
27
+
28
+ ## Installation
29
+
30
+ ### Use as the main database
31
+
32
+ Follow [Install a NocoBase application](/ai/install-nocobase-app). The main difference is the database environment variables.
33
+
34
+ #### Environment variables
35
+
36
+ Add or update these database variables in `.env`:
37
+
38
+ ```bash
39
+ # Adjust DB parameters for your environment.
40
+ DB_DIALECT=kingbase
41
+ DB_HOST=localhost
42
+ DB_PORT=54321
43
+ DB_DATABASE=kingbase
44
+ DB_USER=nocobase
45
+ DB_PASSWORD=nocobase
46
+ ```
47
+
48
+ #### Docker installation
49
+
50
+ ```yml
51
+ networks:
52
+ nocobase:
53
+ driver: bridge
54
+
55
+ services:
56
+ app:
57
+ image: registry.cn-shanghai.aliyuncs.com/nocobase/nocobase:latest
58
+ restart: always
59
+ networks: [nocobase]
60
+ depends_on: [kingbase]
61
+ environment:
62
+ - APP_KEY=your-secret-key
63
+ - DB_DIALECT=kingbase
64
+ - DB_HOST=kingbase
65
+ - DB_PORT=54321
66
+ - DB_DATABASE=kingbase
67
+ - DB_USER=nocobase
68
+ - DB_PASSWORD=nocobase
69
+ - TZ=UTC
70
+ volumes:
71
+ - ./storage:/app/nocobase/storage
72
+ ports:
73
+ - "11000:80"
74
+
75
+ kingbase:
76
+ image: registry.cn-shanghai.aliyuncs.com/nocobase/kingbase:v009r001c001b0030_single_x86
77
+ platform: linux/amd64
78
+ restart: always
79
+ privileged: true
80
+ networks: [nocobase]
81
+ volumes:
82
+ - ./storage/db/kingbase:/home/kingbase/userdata
83
+ environment:
84
+ ENABLE_CI: no
85
+ DB_USER: nocobase
86
+ DB_PASSWORD: nocobase
87
+ DB_MODE: pg
88
+ NEED_START: yes
89
+ command: ["/usr/sbin/init"]
90
+ ```
91
+
92
+ `APP_KEY` is used for user tokens and similar application secrets. Changing it invalidates existing tokens; use a random value and store it safely. The `kingbase` service is intended only for local evaluation. `DB_MODE` must be `pg`.
93
+
94
+ #### Install with create-nocobase-app
95
+
96
+ ```bash
97
+ yarn create nocobase-app my-nocobase-app -d kingbase \
98
+ -e DB_HOST=localhost \
99
+ -e DB_PORT=54321 \
100
+ -e DB_DATABASE=kingbase \
101
+ -e DB_USER=nocobase \
102
+ -e DB_PASSWORD=nocobase \
103
+ -e TZ=Asia/Shanghai
104
+ ```
105
+
106
+ ### Use as an external database
107
+
108
+ For configuration entry points, connection parameters, and synchronization rules when using KingbaseES as an external database, see [External KingbaseES](../external/kingbase.md).
109
+
110
+ ## Usage
111
+
112
+ KingbaseES main data sources use PostgreSQL compatibility mode. For everyday management, see [PostgreSQL main data source](./postgresql.md).
113
+
114
+ 1. Select or enter KingbaseES connection settings when deploying NocoBase.
115
+ 2. After NocoBase starts, open **Data source management**, select **Main**, and manage collections and fields.
116
+ 3. Use **Sync from database** to connect tables that already exist in the main database.
117
+ 4. Use [Collections](../data-modeling/collection.md) and [Collection fields](../data-modeling/collection-fields/index.md) to choose Field types and Field interfaces.
118
+
119
+ ## Field type mapping
120
+
121
+ When you create a field in NocoBase, NocoBase creates the corresponding KingbaseES field. When you synchronize an existing table, NocoBase applies PostgreSQL-compatible mapping to select a Field type and Field interface.
122
+
123
+ | KingbaseES type | NocoBase Field type | Available Field interfaces |
124
+ | --- | --- | --- |
125
+ | `BOOLEAN` | `boolean` | Checkbox, Switch. |
126
+ | `SMALLINT`, `INTEGER` | `integer`, `sort` | Integer, Sort, Select, Radio group. |
127
+ | `BIGINT` | `bigInt`, `snowflakeId`, `unixTimestamp`, `sort` | Integer, Sort, Unix timestamp, Created at, Updated at. |
128
+ | `REAL`, `DOUBLE PRECISION` | `float` | Number, Percent. |
129
+ | `DECIMAL`, `NUMERIC` | `decimal` | Number, Percent, Currency. |
130
+ | `VARCHAR`, `CHAR` | `string`, `uuid`, `nanoid`, `encryption`, `datetimeNoTz` | Input, Email, Phone, Password, Color, Icon, Select, Radio group, UUID, Nano ID. |
131
+ | `TEXT` | `text` | Textarea, Markdown, Vditor, Rich text, URL. |
132
+ | `UUID` | `uuid` | UUID. |
133
+ | `JSON`, `JSONB` | `json`, `array` | JSON. |
134
+ | `TIMESTAMP WITHOUT TIME ZONE` | `datetimeNoTz` | Date, Time, Created at, Updated at. |
135
+ | `TIMESTAMP WITH TIME ZONE` | `datetimeTz`, `date` | Date, Time, Created at, Updated at. |
136
+ | `DATE` | `dateOnly` | Date. |
137
+ | `TIME WITHOUT TIME ZONE` | `time` | Time. |
138
+ | `POINT`, `PATH`, `POLYGON`, `CIRCLE` | `json` | JSON. |
139
+ | `ARRAY` | `array` | Multiple select, Checkbox group, JSON. |
140
+
141
+ :::warning Note
142
+
143
+ Unsupported KingbaseES types are shown separately in field configuration. They require development support before they can be used as normal NocoBase fields.
144
+
145
+ :::
146
+
147
+ For common configuration, see [Main database](./index.md).