|
|
|
@ -9,6 +9,7 @@ import { UITypes } from 'nocodb-sdk';
|
|
|
|
|
// this upgrader is to remove those unsupported filters / migrate to the correct filter
|
|
|
|
|
// changes:
|
|
|
|
|
// - remove `>`, `<`, `>=`, `<=` for text-based columns
|
|
|
|
|
// - remove `like`, `null`, and `empty` for numeric-based columns - migrate to `blank` from `null` and `empty`
|
|
|
|
|
|
|
|
|
|
export default async function ({ ncMeta }: NcUpgraderCtx) { |
|
|
|
|
const filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP); |
|
|
|
@ -32,6 +33,27 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
|
|
|
|
|
if (['gt', 'lt', 'gte', 'lte'].includes(filter.comparison_op)) { |
|
|
|
|
actions.push(await Filter.delete(filter, ncMeta)); |
|
|
|
|
} |
|
|
|
|
} else if ( |
|
|
|
|
[ |
|
|
|
|
UITypes.Duration, |
|
|
|
|
UITypes.Currency, |
|
|
|
|
UITypes.Percent, |
|
|
|
|
UITypes.Number, |
|
|
|
|
UITypes.Decimal, |
|
|
|
|
UITypes.Rating, |
|
|
|
|
UITypes.Rollup, |
|
|
|
|
].includes(col.uidt) |
|
|
|
|
) { |
|
|
|
|
if (['like', 'nlike'].includes(filter.comparison_op)) { |
|
|
|
|
// remove `is like`, `is not like`
|
|
|
|
|
actions.push(await Filter.delete(filter, ncMeta)); |
|
|
|
|
} else if ( |
|
|
|
|
['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op) |
|
|
|
|
) { |
|
|
|
|
// remove `is null`, `is not null`, `is empty`, `is not empty`
|
|
|
|
|
actions.push(await Filter.delete(filter, ncMeta)); |
|
|
|
|
// TODO: migrate to blank / not blank
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
await Promise.all(actions); |
|
|
|
|