|
|
|
@ -12,13 +12,13 @@ import formulaQueryBuilderv2 from '../db/formulav2/formulaQueryBuilderv2';
|
|
|
|
|
import ProjectMgrv2 from '../db/sql-mgr/v2/ProjectMgrv2'; |
|
|
|
|
import { |
|
|
|
|
createHmAndBtColumn, |
|
|
|
|
generateFkName, |
|
|
|
|
generateFkName, populateRollupForLTAR, |
|
|
|
|
randomID, |
|
|
|
|
validateLookupPayload, |
|
|
|
|
validatePayload, |
|
|
|
|
validateRequiredField, |
|
|
|
|
validateRollupPayload, |
|
|
|
|
} from '../helpers'; |
|
|
|
|
} from '../helpers' |
|
|
|
|
import { NcError } from '../helpers/catchError'; |
|
|
|
|
import getColumnPropsFromUIDT from '../helpers/getColumnPropsFromUIDT'; |
|
|
|
|
import { |
|
|
|
@ -32,6 +32,7 @@ import {
|
|
|
|
|
Base, |
|
|
|
|
Column, |
|
|
|
|
FormulaColumn, |
|
|
|
|
GridViewColumn, |
|
|
|
|
KanbanView, |
|
|
|
|
Model, |
|
|
|
|
} from '../models'; |
|
|
|
@ -39,7 +40,11 @@ import Noco from '../Noco';
|
|
|
|
|
import NcConnectionMgrv2 from '../utils/common/NcConnectionMgrv2'; |
|
|
|
|
import { MetaTable } from '../utils/globals'; |
|
|
|
|
import { MetaService } from '../meta/meta.service'; |
|
|
|
|
import type { LinkToAnotherRecordColumn, Project } from '../models'; |
|
|
|
|
import type { |
|
|
|
|
LinkToAnotherRecordColumn, |
|
|
|
|
Project, |
|
|
|
|
RollupColumn, |
|
|
|
|
} from '../models'; |
|
|
|
|
import type SqlMgrv2 from '../db/sql-mgr/v2/SqlMgrv2'; |
|
|
|
|
import type { |
|
|
|
|
ColumnReqType, |
|
|
|
@ -1759,7 +1764,7 @@ export class ColumnsService {
|
|
|
|
|
true, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
await Column.insert({ |
|
|
|
|
const col1 = await Column.insert({ |
|
|
|
|
title: getUniqueColumnAliasName( |
|
|
|
|
await child.getColumns(), |
|
|
|
|
`${parent.title} List`, |
|
|
|
@ -1780,7 +1785,7 @@ export class ColumnsService {
|
|
|
|
|
fk_related_model_id: parent.id, |
|
|
|
|
virtual: (param.column as LinkToAnotherColumnReqType).virtual, |
|
|
|
|
}); |
|
|
|
|
await Column.insert({ |
|
|
|
|
const col2 = await Column.insert({ |
|
|
|
|
title: getUniqueColumnAliasName( |
|
|
|
|
await parent.getColumns(), |
|
|
|
|
param.column.title ?? `${child.title} List`, |
|
|
|
@ -1801,6 +1806,13 @@ export class ColumnsService {
|
|
|
|
|
virtual: (param.column as LinkToAnotherColumnReqType).virtual, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
await populateRollupForLTAR({ |
|
|
|
|
column: col1, |
|
|
|
|
}) |
|
|
|
|
await populateRollupForLTAR({ |
|
|
|
|
column: col2, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// todo: create index for virtual relations as well
|
|
|
|
|
// create index for foreign key in pg
|
|
|
|
|
if (param.base.type === 'pg') { |
|
|
|
@ -1869,4 +1881,5 @@ export class ColumnsService {
|
|
|
|
|
await Column.update(column.id, colBody); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|