Browse Source

fix: delete tables on at import fail

pull/7391/head
mertmit 12 months ago
parent
commit
6bbfa46f81
  1. 1
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts
  2. 11
      packages/nocodb/src/services/tables.service.ts

1
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -2498,6 +2498,7 @@ export class AtImportProcessor {
await this.tablesService.tableDelete({
tableId: table.id,
user: syncDB.user,
forceDeleteRelations: true,
});
}
if (e.message) {

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

@ -162,7 +162,12 @@ export class TablesService {
return Model.updateOrder(param.tableId, param.order);
}
async tableDelete(param: { tableId: string; user: User; req?: any }) {
async tableDelete(param: {
tableId: string;
user: User;
forceDeleteRelations?: boolean;
req?: any;
}) {
const table = await Model.getByIdOrName({ id: param.tableId });
await table.getColumns();
@ -171,7 +176,9 @@ export class TablesService {
const relationColumns = table.columns.filter((c) => isLinksOrLTAR(c));
if (relationColumns?.length && !source.isMeta()) {
const deleteRelations = source.isMeta() || param.forceDeleteRelations;
if (relationColumns?.length && !deleteRelations) {
const referredTables = await Promise.all(
relationColumns.map(async (c) =>
c

Loading…
Cancel
Save