π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: BT reverse column should use LinkToAnotherRecord, fix version heuristic
Pranave645d16c0a78
diff --git a/packages/nocodb/src/models/Column.ts b/packages/nocodb/src/models/Column.tsindex 71660a9456..a9101b0678 100644--- a/packages/nocodb/src/models/Column.ts+++ b/packages/nocodb/src/models/Column.ts@@ -343,13 +343,14 @@ export default class Column<T = any> implements ColumnType {}case UITypes.Links:case UITypes.LinkToAnotherRecord: {- // V1 for hm/bt or oo without junction table (always V1, not overridable)- // For other types, use caller-provided version or default to V2+ // V1 for hm/bt/oo without junction table (always V1, not overridable)+ // If junction table exists (fk_mm_model_id), use caller version or default V2const isV1Heuristic =- [RelationTypes.HAS_MANY, RelationTypes.BELONGS_TO].includes(+ !column.fk_mm_model_id &&+ ([RelationTypes.HAS_MANY, RelationTypes.BELONGS_TO].includes(column.type,) ||- (column.type === RelationTypes.ONE_TO_ONE && !column.fk_mm_model_id);+ column.type === RelationTypes.ONE_TO_ONE);const version: number = isV1Heuristic? LinksVersion.V1diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.tsindex d181876383..c51cfdfd6f 100644--- a/packages/nocodb/src/services/columns.service.ts+++ b/packages/nocodb/src/services/columns.service.ts@@ -5141,7 +5141,14 @@ export class ColumnsService implements IColumnsService {],reverseDefaultTitle,),- uidt: isLinks ? UITypes.Links : UITypes.LinkToAnotherRecord,+ // BT reverse column should always be LinkToAnotherRecord (not Links)+ // to match V1 behavior where BT doesn't show count/rollup+ uidt:+ revType === RelationTypes.BELONGS_TO+ ? UITypes.LinkToAnotherRecord+ : isLinks+ ? UITypes.Links+ : UITypes.LinkToAnotherRecord,type: revType,version: isMMLike ? 2 : 1,