From 91dfbee0a5acde33424ae5377ddb87210caf1b55 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 13 Jun 2024 21:05:59 +0000 Subject: [PATCH] fix: support FK column update(system field) and linting --- packages/nocodb/src/db/BaseModelSqlv2.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 8499751890..67511ab211 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3850,7 +3850,6 @@ class BaseModelSqlv2 { let preInsertOps: (() => Promise)[] = []; let aiPkCol: Column; let agPkCol: Column; - if (!raw) { const columns = await this.model.getColumns(this.context); @@ -3873,7 +3872,11 @@ class BaseModelSqlv2 { ); } - if (col.system && !allowSystemColumn) { + if ( + col.system && + !allowSystemColumn && + col.uidt !== UITypes.ForeignKey + ) { NcError.badRequest( `Column "${col.title}" is system column and cannot be updated`, ); @@ -4950,7 +4953,7 @@ class BaseModelSqlv2 { ); } - if (column.system) { + if (column.system && column.uidt !== UITypes.ForeignKey) { NcError.badRequest( `Column "${column.title}" is system column and cannot be updated`, );