diff --git a/packages/plugins/formula-field/src/server/migrations/20230213161902-alter-field.ts b/packages/plugins/formula-field/src/server/migrations/20230213161903-alter-field.ts similarity index 62% rename from packages/plugins/formula-field/src/server/migrations/20230213161902-alter-field.ts rename to packages/plugins/formula-field/src/server/migrations/20230213161903-alter-field.ts index b20237ff9..5791870da 100644 --- a/packages/plugins/formula-field/src/server/migrations/20230213161902-alter-field.ts +++ b/packages/plugins/formula-field/src/server/migrations/20230213161903-alter-field.ts @@ -19,7 +19,7 @@ export default class extends Migration { options: { ...options, engine: field.get('type') === 'mathFormula' ? 'math.js' : 'formula.js', - dataType: options.dataType === 'number' ? 'double' : 'string' + dataType: options.dataType === 'number' ? 'double' : 'string', }, }); await field.save({ transaction }); @@ -28,34 +28,6 @@ export default class extends Migration { await schema.save({ transaction }); } } - - const AppPlugin = db.getRepository('applicationPlugins'); - const formulaPlugin = await AppPlugin.findOne({ - filter: { - name: 'formula-field', - }, - transaction - }); - - if (!formulaPlugin) { - await AppPlugin.create({ - values: { - name: 'formula-field', - version: '0.9.0-alpha.2', - enabled: true, - installed: true, - builtin: true - }, - transaction - }); - } - - await AppPlugin.destroy({ - filter: { - name: ['math-formula-field', 'excel-formula-field'] - }, - transaction - }); }); } } diff --git a/packages/presets/nocobase/src/migrations/202302221000-del-formula-plugin.ts b/packages/presets/nocobase/src/migrations/202302221000-del-formula-plugin.ts new file mode 100644 index 000000000..4003fef5a --- /dev/null +++ b/packages/presets/nocobase/src/migrations/202302221000-del-formula-plugin.ts @@ -0,0 +1,15 @@ +import { Migration } from '@nocobase/server'; + +export default class extends Migration { + async up() { + const repository = this.context.db.getRepository('applicationPlugins'); + await repository.destroy({ + filter: { + 'name.$in': [ + 'math-formula-field', + 'excel-formula-field', + ], + }, + }); + } +}