fix(acl): no such table: roles

This commit is contained in:
chenos 2022-10-27 15:32:58 +08:00
parent a1fba4ba26
commit f477d80de4

View File

@ -269,7 +269,11 @@ export class PluginACL extends Plugin {
// sync database role data to acl // sync database role data to acl
this.app.on('afterLoad', async (app, options) => { 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(); await this.writeRolesToACL();
} }
}); });
@ -443,7 +447,6 @@ export class PluginACL extends Plugin {
directory: resolve(__dirname, 'collections'), directory: resolve(__dirname, 'collections'),
}); });
} }
} }
export default PluginACL; export default PluginACL;