From 37b1987cac8542a77f4047734fa4a67f9246c4c2 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 5 Jun 2023 12:45:03 +0530 Subject: [PATCH] fix: skip mm hasmany relations Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index c38f0ad51d..dae2103079 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -1909,9 +1909,12 @@ class BaseModelSqlv2 { break; case 'hm': { - const relatedTable = await Model.get( - colOptions.fk_related_model_id, - ); + // skip if it's an mm table column + const relatedTable = await colOptions.getRelatedTable(); + if (relatedTable.mm) { + break; + } + const childColumn = await Column.get({ colId: colOptions.fk_child_column_id, }); @@ -1931,8 +1934,6 @@ class BaseModelSqlv2 { } break; } - - // await trx(this.model.table_name).where(column.column_name, id).del(); } if (!trx) {