From 5921795bce82d0fcf0c85273a3c045cc4a024370 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Thu, 9 Feb 2023 17:38:47 +0800 Subject: [PATCH] feat(nocodb): add checkbox migration --- .../src/lib/version-upgrader/ncFilterUpgrader_0104003.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts b/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts index a38cfc2a72..c570c628e3 100644 --- a/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts +++ b/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0104003.ts @@ -10,6 +10,7 @@ import { UITypes } from 'nocodb-sdk'; // changes: // - remove `>`, `<`, `>=`, `<=` for text-based columns // - 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) { 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)); // 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);