Files
twenty/packages/twenty-server/src/engine/metadata-modules/field-metadata/utils/compute-morph-relation-field-join-column-name.util.ts
T
Guillim 530a7dea86 Morph relation : migration builder (#13173)
This PR will create the migration to be run for the morph relations

- We created a dedicated util to generate the column name and refactored
a little the code in order to have less dependencies and a clearer devX
(updated the snapshot that changed because of this)
- Moved the `createMigrationActions` to its own util as well
- Created the `MorphRelationColumnActionFactory` based on the relation
one

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2025-07-17 11:39:45 +02:00

14 lines
395 B
TypeScript

import { capitalize } from 'twenty-shared/utils';
type ComputeMorphRelationFieldJoinColumnNameArgs = {
name: string;
targetObjectMetadataNameSingular: string;
};
export const computeMorphRelationFieldJoinColumnName = ({
name,
targetObjectMetadataNameSingular,
}: ComputeMorphRelationFieldJoinColumnNameArgs) => {
return `${name}${capitalize(targetObjectMetadataNameSingular)}Id`;
};