Skip to content

Refactor new relation sync #11711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

charlesBochet
Copy link
Member

No description provided.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Refactored workspace relation synchronization logic with improved join column handling and dynamic relation support.

  • Added optional joinColumn property in WorkspaceRelationMetadataArgs interface for explicit join column specification
  • Removed relation-type filtering in getOriginalObjectMetadataCollection, now fetches all fields which may impact performance
  • Renamed updateFieldRelationMetadata to computeFieldRelationMetadataFromDecorators for better clarity
  • Added support for dynamic relations through workspaceDynamicRelationMetadataArgsCollection
  • Improved join column handling with direct joinColumn property check in StandardFieldRelationFactory

3 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 233 to 238
await objectMetadataRepository.find({
where: {
workspaceId: context.workspaceId,
fields: {
type: FieldMetadataType.RELATION,
},
},
relations: ['dataSource', 'fields'],
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Removing the relation type filter here will fetch all fields from the database instead of just relation fields. Consider keeping the filter to optimize database queries.

Copy link
Contributor

github-actions bot commented Apr 23, 2025

TODOs/FIXMEs:

  • // TODO: this is hacky and needs to be simplified: packages/twenty-server/src/engine/workspace-manager/workspace-sync-metadata/factories/standard-field-relation.factory.ts

Generated by 🚫 dangerJS against 970de2b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant