From cf3a6ff2ff5a3f32ff5d840b9a71c61ab27d3f95 Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 9 Aug 2021 10:10:36 +0800 Subject: [PATCH] bugfix --- packages/api/src/migrations/init.ts | 4 +++- packages/client/src/schemas/add-new/index.tsx | 2 +- packages/client/src/schemas/database-field/index.tsx | 6 +++--- packages/client/src/schemas/table/index.tsx | 2 +- packages/plugin-collections/src/collections/fields.ts | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/api/src/migrations/init.ts b/packages/api/src/migrations/init.ts index 11c916c96..2d25e0477 100644 --- a/packages/api/src/migrations/init.ts +++ b/packages/api/src/migrations/init.ts @@ -20,7 +20,9 @@ import * as uiSchema from './ui-schema'; const config = require('@nocobase/plugin-users/src/collections/users').default; const Collection = database.getModel('collections'); const collection = await Collection.create(config); - await collection.updateAssociations(config); + await collection.updateAssociations({ + generalFields: config.fields, + }); await collection.migrate(); const Route = database.getModel('routes'); diff --git a/packages/client/src/schemas/add-new/index.tsx b/packages/client/src/schemas/add-new/index.tsx index 87e569582..79977c3f6 100644 --- a/packages/client/src/schemas/add-new/index.tsx +++ b/packages/client/src/schemas/add-new/index.tsx @@ -618,7 +618,7 @@ const dbSchema = { 'x-component': 'Input', 'x-read-pretty': true, }, - fields: { + generalFields: { type: 'array', title: '数据表字段', 'x-decorator': 'FormItem', diff --git a/packages/client/src/schemas/database-field/index.tsx b/packages/client/src/schemas/database-field/index.tsx index f9875e618..a9cc1eebb 100644 --- a/packages/client/src/schemas/database-field/index.tsx +++ b/packages/client/src/schemas/database-field/index.tsx @@ -120,7 +120,7 @@ export const DatabaseCollection = observer((props) => { field.push({ name: `t_${uid()}`, unsaved: true, - fields: getDefaultFields(), + generalFields: getDefaultFields(), }); } }} @@ -190,7 +190,7 @@ export const DatabaseCollection = observer((props) => { const data = { name: `t_${uid()}`, title: value, - fields: getDefaultFields(), + generalFields: getDefaultFields(), }; field.push(data); setActiveIndex(field.value.length - 1); @@ -229,7 +229,7 @@ export const DatabaseCollection = observer((props) => { field.push({ name: `t_${uid()}`, unsaved: true, - fields: getDefaultFields(), + generalFields: getDefaultFields(), }); } if (activeIndex === index) { diff --git a/packages/client/src/schemas/table/index.tsx b/packages/client/src/schemas/table/index.tsx index 24b523082..e41f61f3d 100644 --- a/packages/client/src/schemas/table/index.tsx +++ b/packages/client/src/schemas/table/index.tsx @@ -538,7 +538,7 @@ const TableMain = () => { /> ))}