|
|
|
@ -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) => |
|
|
|
|