feat: new relation sync-metadata, twenty-orm, create/update (#10217)
Fix https://github.com/twentyhq/core-team-issues/issues/330#issue-2827026606 and https://github.com/twentyhq/core-team-issues/issues/327#issue-2827001814 What this PR does when `isNewRelationEnabled` is set to `true`: - [x] Drop the creation of the foreign key as a `FieldMetadata` - [x] Stop creating `RelationMetadata` - [x] Properly fill `FieldMetadata` of type `RELATION` during the sync command - [x] Use new relation settings in TwentyORM - [x] Properly create `FieldMetadata` relations when we create a new object - [x] Handle `database:reset` with new relations --------- Co-authored-by: Charles Bochet <charles@twenty.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -72,6 +72,7 @@ export class AccessTokenService {
|
||||
await this.twentyORMGlobalManager.getRepositoryForWorkspace<WorkspaceMemberWorkspaceEntity>(
|
||||
workspaceId,
|
||||
'workspaceMember',
|
||||
false,
|
||||
);
|
||||
|
||||
const workspaceMember = await workspaceMemberRepository.findOne({
|
||||
|
||||
@ -62,6 +62,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
workspaceId: '',
|
||||
},
|
||||
},
|
||||
fieldsByJoinColumnName: {},
|
||||
},
|
||||
{
|
||||
id: '',
|
||||
@ -140,6 +141,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
workspaceId: '',
|
||||
},
|
||||
},
|
||||
fieldsByJoinColumnName: {},
|
||||
},
|
||||
{
|
||||
id: '',
|
||||
@ -218,6 +220,7 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
workspaceId: '',
|
||||
},
|
||||
},
|
||||
fieldsByJoinColumnName: {},
|
||||
},
|
||||
{
|
||||
id: '',
|
||||
@ -243,5 +246,6 @@ export const mockObjectMetadataItemsWithFieldMaps: ObjectMetadataItemWithFieldMa
|
||||
indexMetadatas: [],
|
||||
fieldsById: {},
|
||||
fieldsByName: {},
|
||||
fieldsByJoinColumnName: {},
|
||||
},
|
||||
];
|
||||
|
||||
@ -74,6 +74,7 @@ export class SearchService {
|
||||
|
||||
const queryParser = new GraphqlQueryParser(
|
||||
objectMetadataItem.fieldsByName,
|
||||
objectMetadataItem.fieldsByJoinColumnName,
|
||||
generateObjectMetadataMaps([objectMetadataItem]),
|
||||
featureFlagMap,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user