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`, ); diff --git a/packages/nocodb/src/models/Model.ts b/packages/nocodb/src/models/Model.ts index 03ac425610..40a3248635 100644 --- a/packages/nocodb/src/models/Model.ts +++ b/packages/nocodb/src/models/Model.ts @@ -237,11 +237,6 @@ export default class Model implements TableType { let { list: modelList } = cachedList; const { isNoneList } = cachedList; - let condition; - if(source_id){ - condition = { source_id } - } - if (!isNoneList && !modelList.length) { modelList = await ncMeta.metaList2( context.workspace_id, @@ -251,7 +246,7 @@ export default class Model implements TableType { orderBy: { order: 'asc', }, - condition, + ...(source_id ? { condition: { source_id } } : {}), }, );