# Introduction Followup of https://github.com/twentyhq/twenty/pull/17001#pullrequestreview-3638508738 close https://github.com/twentyhq/core-team-issues/issues/1910 We've completely decom the `sync-metadata` in production. We're now then removing its implementation in favor of the v2. ## TODO: - [x] Remove sync-metadata implem and commands - [x] Remove workspace decorators - [x] Type each deprecated field to deprecated on their workspaceEntity - [x] Remove the `workspace-sync-metadata` folder entirely - [x] remove workspace migration - [x] workspace migration removal migration - [x] remove the `v2` references from workspace manager file names - [x] remove the `v2` references from workspace manager modules - [ ] Double check impact on translation file path updates ## Note - Removed the gate logic - Remains some service v2 naming, serverless needs to be migrated on v2 fully - Removed workspaceMigration service app health consumption, making it always returning up ( no more down ) cc @FelixMalfait ( quite obsolete health check now, will require complete refactor once we introduce inter app dependency etc )
159 lines
4.3 KiB
TypeScript
159 lines
4.3 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
type Relation,
|
|
Unique,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
import { type WorkspaceEntityDuplicateCriteria } from 'src/engine/api/graphql/workspace-query-builder/types/workspace-entity-duplicate-criteria.type';
|
|
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
|
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
import { IndexMetadataEntity } from 'src/engine/metadata-modules/index-metadata/index-metadata.entity';
|
|
import { type ObjectStandardOverridesDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-standard-overrides.dto';
|
|
import { FieldPermissionEntity } from 'src/engine/metadata-modules/object-permission/field-permission/field-permission.entity';
|
|
import { ObjectPermissionEntity } from 'src/engine/metadata-modules/object-permission/object-permission.entity';
|
|
import { ViewEntity } from 'src/engine/metadata-modules/view/entities/view.entity';
|
|
import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-entity.interface';
|
|
|
|
@Entity('objectMetadata')
|
|
@Unique('IDX_OBJECT_METADATA_NAME_SINGULAR_WORKSPACE_ID_UNIQUE', [
|
|
'nameSingular',
|
|
'workspaceId',
|
|
])
|
|
@Unique('IDX_OBJECT_METADATA_NAME_PLURAL_WORKSPACE_ID_UNIQUE', [
|
|
'namePlural',
|
|
'workspaceId',
|
|
])
|
|
export class ObjectMetadataEntity
|
|
extends SyncableEntity
|
|
implements Required<ObjectMetadataEntity>
|
|
{
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: true, type: 'uuid' })
|
|
standardId: string | null;
|
|
|
|
@Column({ nullable: false, type: 'uuid' })
|
|
dataSourceId: string;
|
|
|
|
@Column({ nullable: false })
|
|
nameSingular: string;
|
|
|
|
@Column({ nullable: false })
|
|
namePlural: string;
|
|
|
|
@Column({ nullable: false })
|
|
labelSingular: string;
|
|
|
|
@Column({ nullable: false })
|
|
labelPlural: string;
|
|
|
|
@Column({ nullable: true, type: 'text' })
|
|
description: string | null;
|
|
|
|
@Column({ nullable: true, type: 'varchar' })
|
|
icon: string | null;
|
|
|
|
@Column({ type: 'jsonb', nullable: true })
|
|
standardOverrides: ObjectStandardOverridesDTO | null;
|
|
|
|
/**
|
|
* @deprecated
|
|
*/
|
|
@Column({ nullable: false })
|
|
targetTableName: string;
|
|
|
|
@Column({ default: false })
|
|
isCustom: boolean;
|
|
|
|
@Column({ default: false })
|
|
isRemote: boolean;
|
|
|
|
@Column({ default: false })
|
|
isActive: boolean;
|
|
|
|
@Column({ default: false })
|
|
isSystem: boolean;
|
|
|
|
@Column({ default: false })
|
|
isUIReadOnly: boolean;
|
|
|
|
@Column({ default: true })
|
|
isAuditLogged: boolean;
|
|
|
|
@Column({ default: false })
|
|
isSearchable: boolean;
|
|
|
|
@Column({ type: 'jsonb', nullable: true })
|
|
duplicateCriteria: WorkspaceEntityDuplicateCriteria[] | null;
|
|
|
|
@Column({ nullable: true, type: 'varchar' })
|
|
shortcut: string | null;
|
|
|
|
// TODO: This should not be nullable - legacy field introduced when label identifier was nullable
|
|
@Column({ nullable: true, type: 'uuid' })
|
|
labelIdentifierFieldMetadataId: string | null;
|
|
|
|
@Column({ nullable: true, type: 'uuid' })
|
|
imageIdentifierFieldMetadataId: string | null;
|
|
|
|
@Column({ default: false })
|
|
isLabelSyncedWithName: boolean;
|
|
|
|
@OneToMany(() => FieldMetadataEntity, (field) => field.object, {
|
|
cascade: true,
|
|
})
|
|
fields: Relation<FieldMetadataEntity[]>;
|
|
|
|
@OneToMany(() => IndexMetadataEntity, (index) => index.objectMetadata, {
|
|
cascade: true,
|
|
})
|
|
indexMetadatas: Relation<IndexMetadataEntity[]>;
|
|
|
|
@OneToMany(
|
|
() => FieldMetadataEntity,
|
|
(field) => field.relationTargetObjectMetadataId,
|
|
)
|
|
targetRelationFields: Relation<FieldMetadataEntity[]>;
|
|
|
|
@ManyToOne(() => DataSourceEntity, (dataSource) => dataSource.objects, {
|
|
onDelete: 'CASCADE',
|
|
})
|
|
dataSource: Relation<DataSourceEntity>;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt: Date;
|
|
|
|
@OneToMany(
|
|
() => ObjectPermissionEntity,
|
|
(objectPermission) => objectPermission.objectMetadata,
|
|
{
|
|
cascade: true,
|
|
},
|
|
)
|
|
objectPermissions: Relation<ObjectPermissionEntity[]>;
|
|
|
|
@OneToMany(
|
|
() => FieldPermissionEntity,
|
|
(fieldPermission) => fieldPermission.objectMetadata,
|
|
{
|
|
cascade: true,
|
|
},
|
|
)
|
|
fieldPermissions: Relation<FieldPermissionEntity[]>;
|
|
|
|
@OneToMany(() => ViewEntity, (view) => view.objectMetadata, {
|
|
cascade: true,
|
|
})
|
|
views: Relation<ViewEntity[]>;
|
|
}
|