530a7dea86
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>
14 lines
395 B
TypeScript
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`;
|
|
};
|