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>
This commit is contained in:
Guillim
2025-07-17 11:39:45 +02:00
committed by GitHub
parent 0a8a6b652a
commit 530a7dea86
10 changed files with 210 additions and 83 deletions

View File

@ -60,7 +60,7 @@ exports[`Field metadata morph relation creation should fail relation MANY_TO_ONE
"exceptionEventId": "mocked-exception-id",
"userFriendlyMessage": "An error occurred.",
},
"message": "Object metadata relation target not found for relation creation payload",
"message": "Target object metadata does not exist in the object metadata maps",
},
]
`;
@ -153,7 +153,7 @@ exports[`Field metadata morph relation creation should fail relation ONE_TO_MANY
"exceptionEventId": "mocked-exception-id",
"userFriendlyMessage": "An error occurred.",
},
"message": "Object metadata relation target not found for relation creation payload",
"message": "Target object metadata does not exist in the object metadata maps",
},
]
`;

View File

@ -149,7 +149,7 @@ describe('createOne FieldMetadataService morph relation fields', () => {
if (isManyToOne) {
expect(createdField.settings?.joinColumnName).toBe(
'ownerOpportunityForMorphRelationId',
'ownerPersonForMorphRelationId',
);
} else {
expect(createdField.settings?.joinColumnName).toBeUndefined();