{
return constraintName;
};
-
-
-export async function populateRollupForLTAR({ column }: { column: Column }) {
+export async function populateRollupForLTAR({
+ column,
+ columnMeta
+}: {
+ column: Column;
+ columnMeta: any;
+}) {
const model = await column.getModel();
const views = await model.getViews();
@@ -227,6 +235,11 @@ export async function populateRollupForLTAR({ column }: { column: Column }) {
const pkId =
relatedModel.primaryKey?.id || (await relatedModel.getColumns())[0]?.id;
+ const meta = {
+ plural: columnMeta?.plural || pluralize(relatedModel.title),
+ singular: columnMeta?.singular || singularize(relatedModel.title),
+ };
+
await Column.insert({
uidt: UITypes.Links,
title: getUniqueColumnAliasName(
@@ -237,6 +250,7 @@ export async function populateRollupForLTAR({ column }: { column: Column }) {
fk_model_id: model.id,
rollup_function: 'count',
fk_relation_column_id: column.id,
+ meta,
});
const viewCol = await GridViewColumn.list(views[0].id).then((cols) =>
diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.ts
index ad611e556e..840cf8d159 100644
--- a/packages/nocodb/src/services/columns.service.ts
+++ b/packages/nocodb/src/services/columns.service.ts
@@ -1647,6 +1647,7 @@ export class ColumnsService {
(param.column as LinkToAnotherColumnReqType).title,
foreignKeyName,
(param.column as LinkToAnotherColumnReqType).virtual,
+ param.column['meta']
);
} else if ((param.column as LinkToAnotherColumnReqType).type === 'mm') {
const aTn = `${param.project?.prefix ?? ''}_nc_m2m_${randomID()}`;
@@ -1808,9 +1809,11 @@ export class ColumnsService {
await populateRollupForLTAR({
column: col1,
+ columnMeta: param.column['meta']
});
await populateRollupForLTAR({
column: col2,
+ columnMeta: param.column['meta']
});
// todo: create index for virtual relations as well