fix(workflow-action-trigger): change plugin name (#3631)
* fix(plugin-workflow-action-trigger): fix migration * fix(plugin-workflow): fix useless migration logic
This commit is contained in:
		
							parent
							
								
									f9d1e9f0bc
								
							
						
					
					
						commit
						b5ae9343b5
					
				@ -1,7 +1,7 @@
 | 
			
		||||
import { Migration } from '@nocobase/server';
 | 
			
		||||
 | 
			
		||||
export default class extends Migration {
 | 
			
		||||
  appVersion = '<0.19.0-alpha.10';
 | 
			
		||||
  appVersion = '<0.20.0-alpha.6';
 | 
			
		||||
  on = 'afterSync';
 | 
			
		||||
  async up() {
 | 
			
		||||
    const { db } = this.context;
 | 
			
		||||
 | 
			
		||||
@ -9,40 +9,8 @@ export default class extends Migration {
 | 
			
		||||
    }
 | 
			
		||||
    const { db } = this.context;
 | 
			
		||||
 | 
			
		||||
    const PluginModel = db.getModel('applicationPlugins');
 | 
			
		||||
    const NodeRepo = db.getRepository('flow_nodes');
 | 
			
		||||
    await db.sequelize.transaction(async (transaction) => {
 | 
			
		||||
      await [
 | 
			
		||||
        '@nocobase/plugin-workflow-aggregate',
 | 
			
		||||
        '@nocobase/plugin-workflow-delay',
 | 
			
		||||
        '@nocobase/plugin-workflow-dynamic-calculation',
 | 
			
		||||
        '@nocobase/plugin-workflow-loop',
 | 
			
		||||
        '@nocobase/plugin-workflow-manual',
 | 
			
		||||
        '@nocobase/plugin-workflow-parallel',
 | 
			
		||||
        '@nocobase/plugin-workflow-request',
 | 
			
		||||
        '@nocobase/plugin-workflow-sql',
 | 
			
		||||
        '@nocobase/plugin-workflow-form-trigger',
 | 
			
		||||
      ].reduce(
 | 
			
		||||
        (promise, packageName) =>
 | 
			
		||||
          promise.then(async () => {
 | 
			
		||||
            const existed = await PluginModel.findOne({ where: { packageName }, transaction });
 | 
			
		||||
            if (!existed) {
 | 
			
		||||
              await PluginModel.create(
 | 
			
		||||
                {
 | 
			
		||||
                  name: packageName,
 | 
			
		||||
                  packageName,
 | 
			
		||||
                  version: '0.17.0-alpha.1',
 | 
			
		||||
                  enabled: true,
 | 
			
		||||
                  installed: true,
 | 
			
		||||
                  builtin: true,
 | 
			
		||||
                },
 | 
			
		||||
                { transaction },
 | 
			
		||||
              );
 | 
			
		||||
            }
 | 
			
		||||
          }),
 | 
			
		||||
        Promise.resolve(),
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      const nodes = await NodeRepo.find({
 | 
			
		||||
        transaction,
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user