fix: migration error

This commit is contained in:
chenos 2023-02-22 10:18:14 +08:00
parent d25c1b8072
commit a66793282f
2 changed files with 16 additions and 29 deletions

View File

@ -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
});
});
}
}

View File

@ -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',
],
},
});
}
}