Browse Source

feat(nocodb): include upgrader logic for time and year

pull/5306/head
Wing-Kam Wong 2 years ago
parent
commit
b270c41ead
  1. 10
      packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0105003.ts

10
packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader_0105003.ts

@ -5,7 +5,7 @@ import Filter from '../models/Filter';
import type { NcUpgraderCtx } from './NcUpgrader'; import type { NcUpgraderCtx } from './NcUpgrader';
import type NcMetaIO from '../meta/NcMetaIO'; import type NcMetaIO from '../meta/NcMetaIO';
// as of 0.105.3, date / datetime filters include `is like` and `is not like` which are not practical // as of 0.105.3, year, time, date and datetime filters include `is like` and `is not like` which are not practical
// `removeLikeAndNlikeFilters` in this upgrader is simply to remove them // `removeLikeAndNlikeFilters` in this upgrader is simply to remove them
// besides, `null` and `empty` will be migrated to `blank` in `migrateEmptyAndNullFilters` // besides, `null` and `empty` will be migrated to `blank` in `migrateEmptyAndNullFilters`
@ -19,6 +19,9 @@ import type NcMetaIO from '../meta/NcMetaIO';
// - remove `is like` and `is not like` // - remove `is like` and `is not like`
// - migrate `null` or `empty` filters to `blank` // - migrate `null` or `empty` filters to `blank`
// - add `exact date` in comparison_sub_op for existing filters `eq` and `neq` // - add `exact date` in comparison_sub_op for existing filters `eq` and `neq`
// - Year / Time columns:
// - remove `is like` and `is not like`
// - migrate `null` or `empty` filters to `blank`
function removeLikeAndNlikeFilters(filter: Filter, ncMeta: NcMetaIO) { function removeLikeAndNlikeFilters(filter: Filter, ncMeta: NcMetaIO) {
const actions = []; const actions = [];
@ -88,6 +91,11 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
...migrateEmptyAndNullFilters(filter, ncMeta), ...migrateEmptyAndNullFilters(filter, ncMeta),
...migrateEqAndNeqFilters(filter, ncMeta), ...migrateEqAndNeqFilters(filter, ncMeta),
]); ]);
} else if ([UITypes.Time, UITypes.Year].includes(col.uidt)) {
await Promise.all([
...removeLikeAndNlikeFilters(filter, ncMeta),
...migrateEmptyAndNullFilters(filter, ncMeta),
]);
} }
} }
} }

Loading…
Cancel
Save