fix(plugin-workflow): fix migration (#1479)

* fix(plugin-workflow): fix migration

* fix(plugin-workflow): fix migration

* fix(plugin-workflow): change migration name to trigger
This commit is contained in:
Junyi 2023-02-22 13:20:17 +08:00 committed by GitHub
parent f6dad11441
commit 33f6bb4c63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ function migrateData(input) {
export default class extends Migration { export default class extends Migration {
async up() { async up() {
const match = await this.app.version.satisfies('<=0.9.0-alpha.2'); const match = await this.app.version.satisfies('<0.9.0-alpha.3');
if (!match) { if (!match) {
return; return;
} }

View File

@ -49,13 +49,13 @@ const calculatorsMap = {
} }
} }
function migrateConfig({ calculation }) { function migrateConfig({ calculation, ...config }: any = {}) {
if (!calculation?.calculator || !calculation?.operands?.length) { if (!calculation?.calculator || !calculation?.operands?.length) {
return {}; return config;
} }
const calculator = calculatorsMap[calculation.calculator]; const calculator = calculatorsMap[calculation.calculator];
const operands = calculator.operands.map(operand => addQuote(operand)); const operands = (calculator.operands ?? []).map(operand => addQuote(operand));
return { return {
engine: 'formula.js', engine: 'formula.js',
@ -67,7 +67,7 @@ function migrateConfig({ calculation }) {
export default class extends Migration { export default class extends Migration {
async up() { async up() {
const match = await this.app.version.satisfies('<=0.9.0-alpha.2'); const match = await this.app.version.satisfies('<0.9.0-alpha.3');
if (!match) { if (!match) {
return; return;
} }

View File

@ -44,7 +44,7 @@ function migrateConfig({ group: { type = 'and', calculations = [] } }) {
export default class extends Migration { export default class extends Migration {
async up() { async up() {
const match = await this.app.version.satisfies('<=0.9.0-alpha.2'); const match = await this.app.version.satisfies('<0.9.0-alpha.3');
if (!match) { if (!match) {
return; return;
} }