diff --git a/packages/plugins/collection-manager/src/migrations/20230225111111-drop-ui-schema-relation.ts b/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts similarity index 90% rename from packages/plugins/collection-manager/src/migrations/20230225111111-drop-ui-schema-relation.ts rename to packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts index 3fc1fd8b2a..f55c5dcd15 100644 --- a/packages/plugins/collection-manager/src/migrations/20230225111111-drop-ui-schema-relation.ts +++ b/packages/plugins/collection-manager/src/migrations/20230225111112-drop-ui-schema-relation.ts @@ -4,15 +4,6 @@ import { FieldModel } from '../models'; export default class extends Migration { async up() { - const migratedFieldsCount = await this.db.getRepository('fields').count({ - filter: { - 'options.uiSchema': { $exists: true }, - }, - }); - - if (migratedFieldsCount > 0) { - return; - } const transaction = await this.db.sequelize.transaction(); @@ -53,6 +44,10 @@ export default class extends Migration { transaction, }); + if (!uiSchemaRecord) { + continue; + } + const uiSchema = uiSchemaRecord.get('schema'); fieldRecord.set('uiSchema', uiSchema); @@ -68,11 +63,9 @@ export default class extends Migration { try { await migrateFieldsSchema(this.db.getCollection('fields')); - if (this.db.getCollection('fieldsHistory')) { await migrateFieldsSchema(this.db.getCollection('fieldsHistory')); } - await transaction.commit(); } catch (error) { await transaction.rollback();