From 1d11a3e793a0a4e051c387bdff250f266977a5ed Mon Sep 17 00:00:00 2001 From: Chareice Date: Sat, 22 Jan 2022 21:15:23 +0800 Subject: [PATCH] fix: collection manager with sqlite --- packages/plugin-collection-manager/src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/plugin-collection-manager/src/index.ts b/packages/plugin-collection-manager/src/index.ts index 3b1f54c89..427bdcfef 100644 --- a/packages/plugin-collection-manager/src/index.ts +++ b/packages/plugin-collection-manager/src/index.ts @@ -33,12 +33,16 @@ export default class CollectionManagerPlugin extends Plugin { this.app.db.on('fields.afterCreate', afterCreateForReverseField(this.app.db)); this.app.db.on('collections.afterCreate', async (model, options) => { if (options.context) { - await model.migrate(); + process.nextTick(async () => { + await model.migrate(); + }); } }); this.app.db.on('fields.afterCreate', async (model, options) => { if (options.context) { - await model.migrate(); + process.nextTick(async () => { + await model.migrate(); + }); } }); }