Browse Source

fix: handle null project id and missing project

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4961/head
Pranav C 2 years ago
parent
commit
c9c45f1cf5
  1. 20
      packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader.ts

20
packages/nocodb/src/lib/version-upgrader/ncAttachmentUpgrader.ts

@ -47,11 +47,21 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
for (const _base of bases) {
const base = new Base(_base);
const isProjectDeleted = (
await ncMeta.metaGet2(null, null, MetaTable.PROJECT, {
id: base.project_id,
})
).deleted;
// skip if the prodect_id is missing
if (!base.project_id) {
continue;
}
const project = await ncMeta.metaGet2(null, null, MetaTable.PROJECT, {
id: base.project_id,
});
// skip if the project is missing
if (!project) {
continue;
}
const isProjectDeleted = project.deleted;
const knex: Knex = base.is_meta
? ncMeta.knexConnection

Loading…
Cancel
Save