From 8d06c54b03578f45867cb0643a6e9aa027c28afb Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 10 May 2023 18:54:22 +0800 Subject: [PATCH] fix: migration --- .../migrations/20230225111112-drop-ui-schema-relation.ts | 6 ++++++ .../src/migrations/20230509235247-record-picker.ts | 6 ++++++ 2 files changed, 12 insertions(+) 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 688068c53f..9f6bb3e2c1 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,6 +4,12 @@ import { FieldModel } from '../models'; export default class extends Migration { async up() { + const result = await this.app.version.satisfies('<0.9.2-alpha.2'); + + if (!result) { + return; + } + const transaction = await this.db.sequelize.transaction(); const migrateFieldsSchema = async (collection: Collection) => { diff --git a/packages/plugins/ui-schema-storage/src/migrations/20230509235247-record-picker.ts b/packages/plugins/ui-schema-storage/src/migrations/20230509235247-record-picker.ts index cb2ae7f96f..a32aa5a60c 100644 --- a/packages/plugins/ui-schema-storage/src/migrations/20230509235247-record-picker.ts +++ b/packages/plugins/ui-schema-storage/src/migrations/20230509235247-record-picker.ts @@ -41,6 +41,12 @@ export default class extends Migration { } else { continue; } + if (schema['x-component-props']?.mode === 'tags') { + schema['x-component-props']['enableLink'] = true; + } else if (schema['x-component-props']?.mode === 'links') { + schema['x-component-props']['enableLink'] = true; + } + schema['x-component-props']['mode'] = 'Picker'; item.set('schema', schema); await item.save({ transaction }); }