fix: migration error
This commit is contained in:
parent
d25c1b8072
commit
a66793282f
@ -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
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -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',
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user