Morph Relations : deleteOneField (#13349)
This PR adapts teh deleteOneField to make sure morph relations can be deleted, either - from a relation type, - or from a morph relation type (which is the most obvious case). This PR covers - the deletion of fieldMetadata - and the migrationof workspace schemas, by using the already existing definition of relation migrations This PR implements a new test suite: "Delete Object metadata with morph relation" and completes the other test suites for FieldMetadata and ObjectMetadata creation/deletion. Last, we added a nitpick from @paul I forgot on a previous PR on process-nested-realtion-v2 Fixes https://github.com/twentyhq/core-team-issues/issues/1197
This commit is contained in:
+1
-2
@@ -4,7 +4,6 @@ import { FieldMetadataType } from 'twenty-shared/types';
|
||||
import { FindOptionsRelations, ObjectLiteral } from 'typeorm';
|
||||
|
||||
import { ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface';
|
||||
import { FieldMetadataRelationSettings } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface';
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
|
||||
import {
|
||||
@@ -175,7 +174,7 @@ export class ProcessNestedRelationsV2Helper {
|
||||
targetRelation,
|
||||
FieldMetadataType.MORPH_RELATION,
|
||||
)
|
||||
? `${(targetRelation?.settings as FieldMetadataRelationSettings)?.joinColumnName}`
|
||||
? `${targetRelation.settings?.joinColumnName}`
|
||||
: `${targetRelationName}Id`;
|
||||
|
||||
const { relationResults, relationAggregatedFieldsResult } =
|
||||
|
||||
Reference in New Issue
Block a user