π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: update version handling for LTAR type and improve error messaging
Pranav C79746e2d4b59
diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.tsindex c5c00d93ea..982cdb7d87 100644--- a/packages/nocodb/src/services/columns.service.ts+++ b/packages/nocodb/src/services/columns.service.ts@@ -9,7 +9,7 @@ import {isAIPromptCol,isCreatedOrLastModifiedByCol,isCreatedOrLastModifiedTimeCol,- isLinksOrLTAR,+ isLinksOrLTAR, isLTARType,isMMOrMMLike,isServiceUser,isSystemColumn,@@ -3982,7 +3982,7 @@ export class ColumnsService implements IColumnsService {ncMeta,);if (listRanges?.length) {- NcError.badRequest(+ NcError.get(context).badRequest(`The column '${column.title}' is being used in Calendar View. Please update Calendar View first.`,);}@@ -4604,9 +4604,7 @@ export class ColumnsService implements IColumnsService {// in new LTAR type we treat all relation similar to mm, so check if it's new type// version 1 is deprecated and will be removed in future- const isMMLike = (param.column as any).version !== LinksVersion.V1;-- console.log({ isMMLike });+ const isMMLike = ((!(param.column as any).version && isLTARType(param.column) && ![RelationTypes.HAS_MANY, RelationTypes.BELONGS_TO].includes((param.column as LinkToAnotherColumnReqType).type)) || (param.column as any).version && param.column as any).version !== LinksVersion.V1) ;// get table and refTable modelsconst table = await Model.getWithInfo(context, {@@ -4674,8 +4672,7 @@ export class ColumnsService implements IColumnsService {if (((param.column as LinkToAnotherColumnReqType).type === 'hm' ||- (param.column as LinkToAnotherColumnReqType).type === 'bt') &&- !isMMLike+ (param.column as LinkToAnotherColumnReqType).type === 'bt')) {// populate fk column nameconst fkColName = getUniqueColumnName(@@ -5103,7 +5100,7 @@ export class ColumnsService implements IColumnsService {singular:param.column['meta']?.singular || singularize(refTable.title),},-+ version: isMMLike ? 2: 1,// column_order and view_id if provided...param.colExtra,// include cross base link props@@ -5121,6 +5118,7 @@ export class ColumnsService implements IColumnsService {),uidt: isLinks ? UITypes.Links : UITypes.LinkToAnotherRecord,type: revType,+ version: isMMLike ? 2: 1,// ref_db_aliasfk_model_id: refTable.id,