diff --git a/packages/core/server/src/application.ts b/packages/core/server/src/application.ts index edf2606340..e1d525da0a 100644 --- a/packages/core/server/src/application.ts +++ b/packages/core/server/src/application.ts @@ -369,9 +369,11 @@ export class Application exten process.exit(1); } await this.dbVersionCheck({ exit: true }); - await this.load({ - method: argv?.[2], - }); + if (argv?.[2] !== 'upgrade') { + await this.load({ + method: argv?.[2], + }); + } return this.cli.parseAsync(argv, options); } diff --git a/packages/presets/nocobase/src/index.ts b/packages/presets/nocobase/src/index.ts index fa6913de07..3f52dec1e3 100644 --- a/packages/presets/nocobase/src/index.ts +++ b/packages/presets/nocobase/src/index.ts @@ -66,8 +66,10 @@ export class PresetNocoBase extends Plugin { await this.addBuiltInPlugins(); } const builtInPlugins = this.getBuiltInPlugins(); + const plugins = await this.db.getRepository('applicationPlugins').find(); + const pluginNames = plugins.map((p) => p.name); await this.app.pm.add( - builtInPlugins.filter((plugin) => !this.app.pm.has(plugin)), + builtInPlugins.filter((plugin) => !pluginNames.includes(plugin)), { enabled: true, builtIn: true, @@ -76,9 +78,10 @@ export class PresetNocoBase extends Plugin { ); const localPlugins = this.getLocalPlugins(); await this.app.pm.add( - localPlugins.filter((plugin) => !this.app.pm.has(plugin)), + localPlugins.filter((plugin) => !pluginNames.includes(plugin)), {}, ); + await this.app.reload(); }); this.app.on('beforeInstall', async () => { console.log(`Initialize all built-in plugins`);