Fix workspace relation sync (#11963)

## Context

While deploying the IS_NEW_RELATION_ENABLED (we don't compute relation
based on relationMetadata anymore) to existing workspace, I've tested to
run a sync-metadata post feature flag activation. This has raised two
issues:
- the workspaceMigration generator (which is over-complex and should be
refactored later) for fieldMetadata of type RELATION was not handling
settings update properly ;
- we need to delete existing fieldMetadata corresponding to the UUID
foreignKey as they are not needed anymore. This is handled as a 0.53
upgrade command as 0.53 will also come with the full removal of the old
relation system

---------

Co-authored-by: Etienne <45695613+etiennejouan@users.noreply.github.com>
Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
Charles Bochet
2025-05-09 19:03:39 +02:00
committed by GitHub
parent 3308ba56b2
commit 8216800a4a
7 changed files with 166 additions and 63 deletions

View File

@ -35,7 +35,7 @@ export async function determineSchemaRelationDetails(
objectMetadataMaps.byId[fieldMetadata.relationTargetObjectMetadataId];
if (!sourceObjectMetadata || !targetObjectMetadata) {
throw new Error('Object metadata not found');
throw new Error(`Object metadata not found for field ${fieldMetadata.id}`);
}
if (!fieldMetadata.relationTargetFieldMetadataId) {