Identify standard objects (#17091)

# Introduction
Followup https://github.com/twentyhq/twenty/pull/16981

1/ Migration, applicationId and universalIdentifier are required on
entity ( save point migration + upgrade command fallback pattern )
2/ Backfill using previous standard ids
This commit is contained in:
Paul Rastoin
2026-01-12 19:06:13 +01:00
committed by GitHub
parent 04a370e043
commit df108ea040
15 changed files with 427 additions and 12 deletions
@@ -34,7 +34,7 @@ export const getFlatObjectMetadataMock = (
nameSingular: 'defaultflatObjectMetadataNameSingular',
shortcut: 'shortcut',
standardId: null,
applicationId: null,
applicationId: faker.string.uuid(),
standardOverrides: null,
targetTableName: '',
workspaceId: faker.string.uuid(),
@@ -14,6 +14,11 @@ export const fromObjectMetadataEntityToFlatObjectMetadata = (
return {
...objectMetadataEntityWithoutRelations,
// TODO remove once MakeObjectMetadataUniversalIdentifierAndApplicationIdNotNullableMigrationCommand has been run once
universalIdentifier:
objectMetadataEntityWithoutRelations.universalIdentifier ??
objectMetadataEntityWithoutRelations.standardId ??
objectMetadataEntityWithoutRelations.id,
createdAt: objectMetadataEntity.createdAt.toISOString(),
updatedAt: objectMetadataEntity.updatedAt.toISOString(),
viewIds: objectMetadataEntity.views.map((viewEntity) => viewEntity.id),
@@ -23,8 +28,5 @@ export const fromObjectMetadataEntityToFlatObjectMetadata = (
fieldMetadataIds: objectMetadataEntity.fields.map(
(fieldEntity) => fieldEntity.id,
),
universalIdentifier:
objectMetadataEntityWithoutRelations.standardId ??
objectMetadataEntityWithoutRelations.id,
};
};