Deprecate FieldMetadataInterface (#13264)

# Introduction

From the moment replaced the FieldMetadataInterface definition to:
```ts
import { FieldMetadataType } from 'twenty-shared/types';

import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';

export type FieldMetadataInterface<
  T extends FieldMetadataType = FieldMetadataType,
> = FieldMetadataEntity<T>;
```
After this PR merge will create a new one removing the type and
replacing it to `FieldMetadataEntity`.
Did not renamed it here to avoid conflicts on naming + type issues fixs
within the same PR

## Field metadata entity RELATION or MORPH
Relations fields cannot be null for those field metadata entity instance
anymore, but are never for the others see
`packages/twenty-server/src/engine/metadata-modules/field-metadata/types/field-metadata-entity-test.type.ts`
( introduced TypeScript tests )

## Concerns
- TS_VECTOR is the most at risk with the `generatedType` and
`asExpression` removal from interface

## What's next
- `FielMetadataInterface` removal and rename ( see introduction )
- Depcrecating `ObjectMetadataInterface`
- Refactor `FieldMetadataEntity` optional fiels to be nullable only
- TO DIG `never` occurences on settings, defaultValue etc
- Some interfaces will be replaced by the `FlatFieldMetadata` when
deprecating the current sync and comparators tools
This commit is contained in:
Paul Rastoin
2025-07-21 11:30:18 +02:00
committed by GitHub
parent c2a5f95675
commit 47b60bd49f
67 changed files with 1780 additions and 769 deletions

View File

@ -7,6 +7,7 @@ import { WorkspaceInternalContext } from 'src/engine/twenty-orm/interfaces/works
import { WorkspaceDataSource } from 'src/engine/twenty-orm/datasource/workspace.datasource';
import { validateOperationIsPermittedOrThrow } from 'src/engine/twenty-orm/repository/permissions.utils';
import { ObjectMetadataItemWithFieldMaps } from 'src/engine/metadata-modules/types/object-metadata-item-with-field-maps';
import { WorkspaceEntityManager } from './workspace-entity-manager';
@ -88,7 +89,7 @@ describe('WorkspaceEntityManager', () => {
},
fieldIdByName: { fieldName: 'field-id' },
fieldIdByJoinColumnName: {},
},
} as unknown as ObjectMetadataItemWithFieldMaps,
},
idByNameSingular: {
'test-entity': 'test-entity-id',

View File

@ -67,7 +67,7 @@ export class EntitySchemaColumnFactory {
entitySchemaColumnMap[joinColumnName] = {
name: joinColumnName,
type: 'uuid',
nullable: fieldMetadata.isNullable,
nullable: fieldMetadata.isNullable ?? false,
};
continue;
@ -92,7 +92,7 @@ export class EntitySchemaColumnFactory {
type: columnType as ColumnType,
// TODO: We should double check that
primary: key === 'id',
nullable: fieldMetadata.isNullable,
nullable: fieldMetadata.isNullable ?? false,
createDate: key === 'createdAt',
updateDate: key === 'updatedAt',
deleteDate: key === 'deletedAt',

View File

@ -56,7 +56,7 @@ export class WorkspaceDeleteQueryBuilder<
) as this;
}
override async execute(): Promise<DeleteResult> {
override async execute(): Promise<DeleteResult & { generatedMaps: T[] }> {
validateQueryIsPermittedOrThrow(
this.expressionMap,
this.objectRecordsPermissions,