fix: nocobase upgrade error
This commit is contained in:
		
							parent
							
								
									cbf21a5942
								
							
						
					
					
						commit
						9285a8b6a2
					
				@ -369,9 +369,11 @@ export class Application<StateT = DefaultState, ContextT = DefaultContext> exten
 | 
				
			|||||||
      process.exit(1);
 | 
					      process.exit(1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    await this.dbVersionCheck({ exit: true });
 | 
					    await this.dbVersionCheck({ exit: true });
 | 
				
			||||||
 | 
					    if (argv?.[2] !== 'upgrade') {
 | 
				
			||||||
      await this.load({
 | 
					      await this.load({
 | 
				
			||||||
        method: argv?.[2],
 | 
					        method: argv?.[2],
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    return this.cli.parseAsync(argv, options);
 | 
					    return this.cli.parseAsync(argv, options);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -66,8 +66,10 @@ export class PresetNocoBase extends Plugin {
 | 
				
			|||||||
        await this.addBuiltInPlugins();
 | 
					        await this.addBuiltInPlugins();
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      const builtInPlugins = this.getBuiltInPlugins();
 | 
					      const builtInPlugins = this.getBuiltInPlugins();
 | 
				
			||||||
 | 
					      const plugins = await this.db.getRepository('applicationPlugins').find();
 | 
				
			||||||
 | 
					      const pluginNames = plugins.map((p) => p.name);
 | 
				
			||||||
      await this.app.pm.add(
 | 
					      await this.app.pm.add(
 | 
				
			||||||
        builtInPlugins.filter((plugin) => !this.app.pm.has(plugin)),
 | 
					        builtInPlugins.filter((plugin) => !pluginNames.includes(plugin)),
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          enabled: true,
 | 
					          enabled: true,
 | 
				
			||||||
          builtIn: true,
 | 
					          builtIn: true,
 | 
				
			||||||
@ -76,9 +78,10 @@ export class PresetNocoBase extends Plugin {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
      const localPlugins = this.getLocalPlugins();
 | 
					      const localPlugins = this.getLocalPlugins();
 | 
				
			||||||
      await this.app.pm.add(
 | 
					      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 () => {
 | 
					    this.app.on('beforeInstall', async () => {
 | 
				
			||||||
      console.log(`Initialize all built-in plugins`);
 | 
					      console.log(`Initialize all built-in plugins`);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user