From f477d80de4ecb6aa0db69f6f6d00b1d22f637a59 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 27 Oct 2022 15:32:58 +0800 Subject: [PATCH] fix(acl): no such table: roles --- packages/plugins/acl/src/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugins/acl/src/server.ts b/packages/plugins/acl/src/server.ts index 7b19c0e12..8a487a06f 100644 --- a/packages/plugins/acl/src/server.ts +++ b/packages/plugins/acl/src/server.ts @@ -269,7 +269,11 @@ export class PluginACL extends Plugin { // sync database role data to acl this.app.on('afterLoad', async (app, options) => { - if (options.method !== 'install') { + if (options.method === 'install') { + return; + } + const exists = await this.app.db.collectionExistsInDb('roles'); + if (exists) { await this.writeRolesToACL(); } }); @@ -443,7 +447,6 @@ export class PluginACL extends Plugin { directory: resolve(__dirname, 'collections'), }); } - } export default PluginACL;