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:
@ -31,6 +31,7 @@ describe('checkFields', () => {
|
||||
...objectMetadataItemMock,
|
||||
fieldsById,
|
||||
fieldsByName,
|
||||
fieldsByJoinColumnName: {},
|
||||
};
|
||||
|
||||
it('should check field types', () => {
|
||||
|
||||
@ -32,6 +32,7 @@ describe('getFieldType', () => {
|
||||
...objectMetadataItemMock,
|
||||
fieldsById,
|
||||
fieldsByName,
|
||||
fieldsByJoinColumnName: {},
|
||||
};
|
||||
|
||||
it('should get field type', () => {
|
||||
|
||||
@ -61,6 +61,7 @@ describe('mapFieldMetadataToGraphqlQuery', () => {
|
||||
...objectMetadataItemMock,
|
||||
fieldsById,
|
||||
fieldsByName,
|
||||
fieldsByJoinColumnName: {},
|
||||
};
|
||||
|
||||
const objectMetadataMapsMock: ObjectMetadataMaps = {
|
||||
|
||||
@ -33,6 +33,7 @@ describe('checkFilterEnumValues', () => {
|
||||
...objectMetadataItemMock,
|
||||
fieldsById,
|
||||
fieldsByName,
|
||||
fieldsByJoinColumnName: {},
|
||||
};
|
||||
|
||||
it('should check properly', () => {
|
||||
|
||||
@ -43,6 +43,7 @@ describe('parseFilter', () => {
|
||||
...objectMetadataItemMock,
|
||||
fieldsById,
|
||||
fieldsByName,
|
||||
fieldsByJoinColumnName: {},
|
||||
};
|
||||
|
||||
it('should parse string filter test 1', () => {
|
||||
|
||||
Reference in New Issue
Block a user