Browse Source

refactor: on connecting exteranl db create Links

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
8e364b83d6
  1. 9
      packages/nocodb/src/helpers/populateMeta.ts

9
packages/nocodb/src/helpers/populateMeta.ts

@ -1,5 +1,6 @@
import { ModelTypes, UITypes, ViewTypes } from 'nocodb-sdk';
import { isVirtualCol, RelationTypes } from 'nocodb-sdk';
import { pluralize, singularize } from 'inflection';
import { GridViewColumn } from '../models';
import Column from '../models/Column';
import Model from '../models/Model';
@ -465,15 +466,19 @@ export async function populateRollupColumnAndHideLTAR(
relatedModel.primaryKey?.id || (await relatedModel.getColumns())[0]?.id;
await Column.insert<RollupColumn>({
uidt: 'Rollup',
uidt: UITypes.Links,
title: getUniqueColumnAliasName(
await model.getColumns(),
`${relatedModel.title} Count`,
`${relatedModel.title}`,
),
fk_rollup_column_id: pkId,
fk_model_id: model.id,
rollup_function: 'count',
fk_relation_column_id: column.id,
meta: {
singular: singularize(relatedModel.title),
plural: pluralize(relatedModel.title),
},
});
const viewCol = await GridViewColumn.list(views[0].id).then((cols) =>

Loading…
Cancel
Save