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:
@ -1,12 +1,10 @@
|
||||
import { ObjectType } from 'typeorm';
|
||||
|
||||
import { RelationOnDeleteAction } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-on-delete-action.interface';
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||
|
||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import {
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
|
||||
export type WorkspaceDynamicRelationMetadataArgsFactory = (
|
||||
oppositeObjectMetadata: ObjectMetadataEntity,
|
||||
@ -57,7 +55,7 @@ export interface WorkspaceDynamicRelationMetadataArgs {
|
||||
/**
|
||||
* Relation type.
|
||||
*/
|
||||
readonly type: RelationMetadataType;
|
||||
readonly type: RelationType;
|
||||
|
||||
/**
|
||||
* Relation inverse side target.
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { ObjectMetadataMaps } from 'src/engine/metadata-modules/types/object-metadata-maps';
|
||||
|
||||
export interface WorkspaceInternalContext {
|
||||
workspaceId: string;
|
||||
objectMetadataMaps: ObjectMetadataMaps;
|
||||
featureFlagsMap: Record<FeatureFlagKey, boolean>;
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import { ObjectType } from 'typeorm';
|
||||
|
||||
import { RelationOnDeleteAction } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-on-delete-action.interface';
|
||||
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
|
||||
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||
|
||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
import {
|
||||
RelationMetadataType,
|
||||
RelationOnDeleteAction,
|
||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
|
||||
export interface WorkspaceRelationMetadataArgs {
|
||||
/**
|
||||
@ -33,7 +31,7 @@ export interface WorkspaceRelationMetadataArgs {
|
||||
/**
|
||||
* Relation type.
|
||||
*/
|
||||
readonly type: RelationMetadataType;
|
||||
readonly type: RelationType;
|
||||
|
||||
/**
|
||||
* Relation description.
|
||||
|
||||
Reference in New Issue
Block a user