twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Workspace syncmetadata does not handle relation name changes

Open Weiko opened this issue 10 months ago • 0 comments

Bug Description

We've renamed the property eventParticipants to calendarEventParticipants within the calendarEvent object, without modifying its standard-id but the workspace sync failed.

Sync of standard objects failed with: Error: Field calendarEventParticipants not found in object calendarEvent
        for relation FROM defined in class calendarEvent
    at assert (/app/packages/twenty-server/dist/src/utils/assert.js:27:15)
    at /app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/factories/standard-relation.factory.js:49:32
    at Array.map (<anonymous>)
    at StandardRelationFactory.createRelationMetadata (/app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/factories/standard-relation.factory.js:36:193)
    at /app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/factories/standard-relation.factory.js:24:112
    at Array.flatMap (<anonymous>)
    at StandardRelationFactory.create (/app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/factories/standard-relation.factory.js:24:73)
    at WorkspaceSyncRelationMetadataService.synchronize (/app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/services/workspace-sync-relation-metadata.service.js:63:81)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async WorkspaceSyncMetadataService.synchronize (/app/packages/twenty-server/dist/src/engine/workspace-manager/workspace-sync-metadata/workspace-sync-metadata.service.js:63:49)

Technical inputs

The command should be able to rename the field-metadata and create a migration to rename the foreign key

Weiko avatar Apr 17 '24 12:04 Weiko