mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:15:36 +00:00
fix: migration error
This commit is contained in:
parent
aece9015aa
commit
cb97c7ae5c
@ -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();
|
Loading…
Reference in New Issue
Block a user