Browse Source

feat(nocodb): add checkbox migration

pull/5106/head
Wing-Kam Wong 2 years ago
parent
commit
5921795bce
  1. 8
      packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts

8
packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts

@ -10,6 +10,7 @@ import { UITypes } from 'nocodb-sdk';
// changes: // changes:
// - remove `>`, `<`, `>=`, `<=` for text-based columns // - remove `>`, `<`, `>=`, `<=` for text-based columns
// - remove `like`, `null`, and `empty` for numeric-based columns - migrate to `blank` from `null` and `empty` // - remove `like`, `null`, and `empty` for numeric-based columns - migrate to `blank` from `null` and `empty`
// - remove `is null`, `is not null` for checkbox columns - migrate `equal` and `not equal` to `checked` and `not checked`
export default async function ({ ncMeta }: NcUpgraderCtx) { export default async function ({ ncMeta }: NcUpgraderCtx) {
const filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP); const filters = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP);
@ -58,6 +59,13 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
actions.push(await Filter.delete(filter, ncMeta)); actions.push(await Filter.delete(filter, ncMeta));
// TODO: migrate to blank / not blank // TODO: migrate to blank / not blank
} }
} else if (col.uidt === UITypes.Checkbox) {
if (['eq', 'neq'].includes(filter.comparison_op)) {
// TODO: migrate to `checked` or `not-checked`
} else if (['null', 'notnull'].includes(filter.comparison_op)) {
// remove `is null`, `is not null`
actions.push(await Filter.delete(filter, ncMeta));
}
} }
} }
await Promise.all(actions); await Promise.all(actions);

Loading…
Cancel
Save