Remove dead code from legacy metadataVersion cache mechanism (#23122)

- Drop unused setORMEntitySchema/getORMEntitySchema from
WorkspaceCacheStorageService
- Drop MetadataObjectMetadataMaps cache key, only referenced by the
flush loop
- Drop never-populated workspaceMetadataVersion field from workspace
auth context type and builders
- Drop unthrown TwentyORMExceptionCode.METADATA_VERSION_MISMATCH
- Drop unused WorkspaceMetadataVersionModule imports in field-metadata
and object-metadata modules

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/23122?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Weiko
2026-07-21 18:52:51 +02:00
committed by GitHub
parent cf5e6b7bad
commit 28adcbffb9
10 changed files with 0 additions and 45 deletions
@@ -3,7 +3,6 @@ import { Injectable } from '@nestjs/common';
import crypto from 'crypto';
import { isDefined } from 'twenty-shared/utils';
import { type EntitySchemaOptions } from 'typeorm';
import { type FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
@@ -14,7 +13,6 @@ import { CacheStorageNamespace } from 'src/engine/core-modules/cache-storage/typ
export const METADATA_VERSIONED_WORKSPACE_CACHE_KEY = {
GraphQLTypeDefs: 'graphql:type-defs',
MetadataVersion: 'metadata:workspace-metadata-version',
MetadataObjectMetadataMaps: 'metadata:object-metadata-maps',
GraphQLUsedScalarNames: 'graphql:used-scalar-names',
ORMEntitySchemas: 'orm:entity-schemas',
} as const;
@@ -44,31 +42,6 @@ export class WorkspaceCacheStorageService {
private readonly cacheStorageService: CacheStorageService,
) {}
setORMEntitySchema(
workspaceId: string,
metadataVersion: number,
// oxlint-disable-next-line typescript/no-explicit-any
entitySchemas: EntitySchemaOptions<any>[],
) {
// oxlint-disable-next-line typescript/no-explicit-any
return this.cacheStorageService.set<EntitySchemaOptions<any>[]>(
`${METADATA_VERSIONED_WORKSPACE_CACHE_KEY.ORMEntitySchemas}:${workspaceId}:${metadataVersion}`,
entitySchemas,
TTL_ONE_WEEK,
);
}
getORMEntitySchema(
workspaceId: string,
metadataVersion: number,
// oxlint-disable-next-line typescript/no-explicit-any
): Promise<EntitySchemaOptions<any>[] | undefined> {
// oxlint-disable-next-line typescript/no-explicit-any
return this.cacheStorageService.get<EntitySchemaOptions<any>[]>(
`${METADATA_VERSIONED_WORKSPACE_CACHE_KEY.ORMEntitySchemas}:${workspaceId}:${metadataVersion}`,
);
}
setMetadataVersion(
workspaceId: string,
metadataVersion: number,