π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
feat: disable LTAR v2 by default and gate behind feature flag (beta)
Pranav Cdb524d661631
diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vueindex 1cd5caa942..27efe63e40 100644--- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue+++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue@@ -1278,6 +1278,7 @@ const unique = computed({{{ UITypesName[opt.name] }}<spanv-if="+ isFeatureEnabled(FEATURE_FLAG.LTAR_V2) &&isEdit &&column &&column.uidt === UITypes.LinkToAnotherRecord &&diff --git a/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue b/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vueindex 3402ae92c8..0948be5d92 100644--- a/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue@@ -1,6 +1,7 @@<script setup lang="ts">import {type LinkToAnotherRecordType,+ LinksVersion,ModelTypes,PlanFeatureTypes,PlanTitles,@@ -226,6 +227,23 @@ const refViews = computed(() => {const isLinks = computed(() => vModel.value.uidt === UITypes.Links && vModel.value.type !== RelationTypes.ONE_TO_ONE)+const isLtarV2Enabled = computed(() => isFeatureEnabled(FEATURE_FLAG.LTAR_V2))++// Set version based on feature flag and relation type+watch(+ [() => vModel.value.type, isLtarV2Enabled],+ () => {+ if (isEdit.value) return++ if (isLtarV2Enabled.value) {+ vModel.value.version = LinksVersion.V2+ } else {+ delete vModel.value.version+ }+ },+ { immediate: true },+)+watch(() => (vModel.value?.is_custom_link ? vModel.value?.custom?.ref_model_id : vModel.value?.childId),async (tableId) => {diff --git a/packages/nc-gui/composables/useBetaFeatureToggle.ts b/packages/nc-gui/composables/useBetaFeatureToggle.tsindex 8450b6398b..e64d65fc51 100644--- a/packages/nc-gui/composables/useBetaFeatureToggle.ts+++ b/packages/nc-gui/composables/useBetaFeatureToggle.ts@@ -147,6 +147,14 @@ const FEATURES = [version: 1,isEE: true,},+ {+ id: 'ltar_v2',+ title: 'Links V2',+ description: 'Use junction table based relations for all link types (beta).',+ enabled: false,+ version: 1,+ isEngineering: true,+ },{id: 'view_actions',title: 'View Actions',diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.tsindex ddd541e3b5..e9785ddb5e 100644--- a/packages/nocodb/src/services/columns.service.ts+++ b/packages/nocodb/src/services/columns.service.ts@@ -4603,16 +4603,13 @@ export class ColumnsService implements IColumnsService {const reuse = param.reuse ?? {};- // 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+ // v2 LTAR uses junction table for all relation types (like mm)+ // v1 is the default - v2 is only used when explicitly requested via version paramconst isMMLike =- (!(param.column as any).version &&- isLTARType(param.column) &&- ![RelationTypes.HAS_MANY, RelationTypes.BELONGS_TO].includes(- (param.column as LinkToAnotherColumnReqType).type as RelationTypes,- )) ||- ((param.column as any).version &&- (param.column as any).version !== LinksVersion.V1);+ (param.column as any).version === LinksVersion.V2 ||+ // traditional MM is always treated as MM-like regardless of version+ (param.column as LinkToAnotherColumnReqType).type ===+ RelationTypes.MANY_TO_MANY;// get table and refTable modelsconst table = await Model.getWithInfo(context, {@@ -4679,8 +4676,9 @@ export class ColumnsService implements IColumnsService {}if (- (param.column as LinkToAnotherColumnReqType).type === 'hm' ||- (param.column as LinkToAnotherColumnReqType).type === 'bt'+ !isMMLike &&+ ((param.column as LinkToAnotherColumnReqType).type === 'hm' ||+ (param.column as LinkToAnotherColumnReqType).type === 'bt')) {// populate fk column nameconst fkColName = getUniqueColumnName(