fix: transaction cannot be rolled back because it has been finished
This commit is contained in:
parent
89284bb175
commit
aece9015aa
@ -1,6 +1,6 @@
|
|||||||
|
import { Collection } from '@nocobase/database';
|
||||||
import { Migration } from '@nocobase/server';
|
import { Migration } from '@nocobase/server';
|
||||||
import { FieldModel } from '../models';
|
import { FieldModel } from '../models';
|
||||||
import { Collection } from '@nocobase/database';
|
|
||||||
|
|
||||||
export default class extends Migration {
|
export default class extends Migration {
|
||||||
async up() {
|
async up() {
|
||||||
@ -62,7 +62,6 @@ export default class extends Migration {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await transaction.commit();
|
|
||||||
collection.removeField('uiSchemaUid');
|
collection.removeField('uiSchemaUid');
|
||||||
this.app.log.info('Migrate uiSchema to options field done');
|
this.app.log.info('Migrate uiSchema to options field done');
|
||||||
};
|
};
|
||||||
@ -73,6 +72,8 @@ export default class extends Migration {
|
|||||||
if (this.db.getCollection('fieldsHistory')) {
|
if (this.db.getCollection('fieldsHistory')) {
|
||||||
await migrateFieldsSchema(this.db.getCollection('fieldsHistory'));
|
await migrateFieldsSchema(this.db.getCollection('fieldsHistory'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await transaction.commit();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await transaction.rollback();
|
await transaction.rollback();
|
||||||
this.app.log.error(error);
|
this.app.log.error(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user