From 907eb72efc96e129ebd1eceab3c77427114cdcc2 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 12 Mar 2023 18:44:45 +0800 Subject: [PATCH] fix: column ui_schema_id does not exist --- .../migrations/20230225111112-drop-ui-schema-relation.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts b/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts index f55c5dcd1..688068c53 100644 --- a/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts +++ b/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts @@ -4,16 +4,21 @@ import { FieldModel } from '../models'; export default class extends Migration { async up() { - const transaction = await this.db.sequelize.transaction(); const migrateFieldsSchema = async (collection: Collection) => { this.app.log.info(`Start to migrate ${collection.name} collection's ui schema`); - collection.setField('uiSchemaUid', { + const field = collection.setField('uiSchemaUid', { type: 'string', }); + const exists = await field.existsInDb({ transaction }); + + if (!exists) { + return; + } + const fieldRecords: Array = await collection.repository.find({ transaction, });