Browse Source

fix: on self reference hide the second column generated

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
029730aa93
  1. 3
      packages/nocodb/src/helpers/columnHelpers.ts
  2. 6
      packages/nocodb/src/services/columns.service.ts

3
packages/nocodb/src/helpers/columnHelpers.ts

@ -55,7 +55,8 @@ export async function createHmAndBtColumn(
fk_parent_column_id: parent.primaryKey.id,
fk_related_model_id: parent.id,
virtual,
system: isSystemCol,
// if self referencing treat it as system field to hide from ui
system: isSystemCol || parent.id === child.id,
fk_col_name: fkColName,
fk_index_name: fkColName,
});

6
packages/nocodb/src/services/columns.service.ts

@ -1776,7 +1776,7 @@ export class ColumnsService {
true,
);
const col1 = await Column.insert({
await Column.insert({
title: getUniqueColumnAliasName(
await child.getColumns(),
`${parent.title} List`,
@ -1800,8 +1800,10 @@ export class ColumnsService {
plural: pluralize(parent.title),
singular: singularize(parent.title),
},
// if self referencing treat it as system field to hide from ui
system: parent.id === child.id,
});
const col2 = await Column.insert({
await Column.insert({
title: getUniqueColumnAliasName(
await parent.getColumns(),
param.column.title ?? `${child.title} List`,

Loading…
Cancel
Save