Browse Source

fix: handle if column missing

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5816/head
Pranav C 1 year ago
parent
commit
0da392e450
  1. 35
      packages/nocodb/src/services/tables.service.ts

35
packages/nocodb/src/services/tables.service.ts

@ -182,22 +182,25 @@ export class TablesService {
let result; let result;
try { try {
// delete all relations // delete all relations
await Promise.all( for (const c of relationColumns) {
relationColumns.map((c) => { // skip if column is hasmany relation to mm table
// skip if column is hasmany relation to mm table if (c.system) {
if (c.system) { continue;
return; }
}
// verify column exist or not and based on that delete the column
return this.columnsService.columnDelete( if (!(await Column.get({ colId: c.id }))) {
{ continue;
req: param.req, }
columnId: c.id,
}, await this.columnsService.columnDelete(
ncMeta, {
); req: param.req,
}), columnId: c.id,
); },
ncMeta,
);
}
const sqlMgr = await ProjectMgrv2.getSqlMgr(project, ncMeta); const sqlMgr = await ProjectMgrv2.getSqlMgr(project, ncMeta);
(table as any).tn = table.table_name; (table as any).tn = table.table_name;

Loading…
Cancel
Save